/* STC Tree Risk Management Dashboard — page styles (split out of index.html, A3) */
:root{
  --stc-blue:#045FA5;
  --stc-navy:#003649;
  --stc-mist:#F4F5F8;
  --ink:#12232B;
  --ink-soft:#5B6B74;
  --rule:#DDE3E8;
  --white:#fff;
  --p-immediate:#111111;
  --p-urgent:#7A0A16;
  --p-high:#C8102E;
  --p-medium:#E8912A;
  --p-low:#3E9B52;
  --p-none:#9AA7B4;
  --overdue:#B3121D;
  --ok:#3E9B52;
  --shadow:0 1px 2px rgba(0,54,73,.06),0 4px 16px rgba(0,54,73,.07);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:Calibri,"Segoe UI",system-ui,-apple-system,sans-serif;
  background:var(--stc-mist);
  color:var(--ink);
  font-size:15px;
  line-height:1.45;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3{margin:0;font-weight:600;letter-spacing:-.01em}
button{font-family:inherit;font-size:inherit;cursor:pointer}

/* ── Masthead ─────────────────────────────────────── */
:root{--masthead-h:72px}
html,body{height:100%;overflow:hidden}
.masthead{
  display:flex;align-items:center;gap:20px;
  padding:14px 24px;background:var(--white);
  border-bottom:2px solid var(--stc-blue);
  position:sticky;top:0;z-index:900;height:var(--masthead-h);
}
.masthead .logo{height:42px;width:auto;margin-left:22px;padding-left:22px;border-left:1px solid var(--rule)}
.chip.who{flex-direction:column;align-items:flex-start;gap:0;line-height:1.25;padding:5px 14px}
.chip.who .role{font-size:10.5px;font-weight:500;letter-spacing:.06em;text-transform:uppercase;color:var(--ink-soft)}

/* ── Sign-in gate ── */
.gate{
  position:fixed;inset:0;z-index:2000;background:var(--stc-navy);
  display:grid;place-items:center;padding:24px;
  /* inset:0 resolves against the small viewport on mobile. When the address
     bar collapses the layout viewport grows and a strip of the page shows
     below the overlay, so the height is pinned to the dynamic viewport too. */
  min-height:100vh; min-height:100dvh;
  overflow:auto; overscroll-behavior:contain;
}
.gate.off{display:none}
/* Nothing behind the gate should scroll while it is up.
   Locking body alone is not enough: on mobile the scrolling element is often
   the documentElement, so the class goes on both. */
html.gated, body.gated{overflow:hidden}

/* Belt and braces, and the part that actually fixes it. Rather than trusting a
   fixed overlay to cover a viewport that changes height as the address bar
   collapses, the page behind is hidden outright — so there is nothing to
   glimpse whatever the viewport does. visibility rather than display, so
   Leaflet keeps its layout and needs no invalidateSize() on reveal. */
body.gated .wrap{visibility:hidden}

/* Any strip that does appear is then the same colour as the gate. */
body.gated{background:var(--stc-navy)}
.gate-card{
  background:var(--white);border-radius:8px;padding:34px 34px 26px;max-width:400px;width:100%;
  text-align:center;box-shadow:0 18px 60px rgba(0,0,0,.35);
}
.gate-logo{height:44px;width:auto;margin-bottom:20px}
.gate-card h2{font-size:21px;line-height:1.25;color:var(--stc-navy);margin:0 0 18px}
.gate-sub{font-size:14px;color:var(--ink-soft);margin:0 0 20px}
.gate-msg{font-size:13.5px;color:var(--ink);margin:0 0 18px;line-height:1.5}
.gate-msg.err{color:var(--overdue);font-weight:600}
.spin{display:inline-block;width:13px;height:13px;margin-right:8px;vertical-align:-2px;
  border:2px solid var(--rule);border-top-color:var(--stc-blue);border-radius:50%;
  animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.site-btn:disabled{opacity:.45;cursor:default}
.site-btn.chosen{opacity:1;border-color:var(--stc-blue);background:var(--stc-mist);
  position:relative}
.site-btn.chosen::after{content:"";position:absolute;right:14px;top:50%;margin-top:-7px;
  width:13px;height:13px;border:2px solid var(--rule);border-top-color:var(--stc-blue);
  border-radius:50%;animation:spin .8s linear infinite}
#gsiButton{display:flex;justify-content:center;min-height:44px}
.gate-note{font-size:11.5px;color:var(--ink-soft);margin:18px 0 0}
/* Overlay name on hover — Site boundary, Conservation area, TPO, etc. */
.ovl-tip{font-weight:600;font-size:12px;color:var(--stc-navy);
  background:rgba(255,255,255,.95);border:1px solid var(--rule);
  box-shadow:0 1px 4px rgba(0,54,73,.2);padding:3px 8px}

.stc-only{display:none}
body.role-stc .stc-only{display:inline-flex}
.stc-only-block{display:none}
body.role-stc .stc-only-block{display:block}
/* Visible to STC and estate staff, but not to contractors: the inspection
   regime is the estate's own business and their first policy KPI, while a
   contractor is only concerned with the works in front of them. */
/* Shown when the backend grants the audit right (STC and estate staff); STC always,
   so the button does not vanish for STC while an older backend is still deployed. */
.audit-only{display:none}
body.can-audit .audit-only, body.role-stc .audit-only{display:inline-flex}
.chip.stc-only{display:none}                /* .chip sets display, so the role rule needs the extra class */
body.role-stc .chip.stc-only{display:inline-flex}
.staff-only-block{display:none}
body.role-stc .staff-only-block,
body.role-estate .staff-only-block{display:block}

/* ── Bulk update ── */
.bulk-card{width:min(760px,100%);max-height:min(88vh,900px)}
.bulk-sub{font-size:12.5px;color:var(--ink-soft);margin-top:2px}
.bulk-tools{display:flex;align-items:center;gap:12px;padding:9px 22px;
  border-bottom:1px solid var(--rule);background:var(--stc-mist)}
.bulk-all{font-size:13px;color:var(--stc-navy);display:flex;align-items:center;gap:7px;cursor:pointer}
.bulk-count{font-size:12.5px;color:var(--ink-soft);font-variant-numeric:tabular-nums}
.bulk-body{padding:0}
.bulk-tbl{width:100%;border-collapse:collapse;font-size:13px}
.bulk-tbl td{padding:7px 10px;border-bottom:1px solid var(--rule);vertical-align:top}
.bulk-tbl td:first-child{padding-left:22px;width:30px}
.bulk-tbl td:last-child{padding-right:22px}
.bulk-tbl tr:hover{background:var(--stc-mist)}
.bulk-tbl .bid{font-weight:600;color:var(--stc-navy);white-space:nowrap}
.bulk-tbl .brec{color:var(--ink);line-height:1.35}
.bulk-tbl .bzone{color:var(--ink-soft);font-size:12px;white-space:nowrap}
.bulk-foot{gap:9px}
.bulk-empty{padding:26px 22px;text-align:center;color:var(--ink-soft);font-size:13px}
.bulk-progress{font-size:12.5px;color:var(--ink-soft)}

/* ── Terms of use ── */
.nodata{font-size:12px;color:var(--ink-soft);padding:10px 14px;line-height:1.45}
.nodata.small{font-size:11px;padding:2px 14px 8px}
.terms-link{margin:2px 0 0;text-align:left}
.terms-link button{background:none;border:none;font-size:12px;color:var(--ink-soft);
  text-decoration:underline;text-underline-offset:2px;cursor:pointer;padding:4px 0}
.terms-link button:hover{color:var(--stc-blue)}
.modal{position:fixed;inset:0;z-index:1600;background:rgba(0,54,73,.45);
  display:none;place-items:center;padding:24px}
.modal.on{display:grid}
.modal-card{background:var(--white);border-radius:8px;width:min(680px,100%);
  max-height:min(86vh,860px);display:flex;flex-direction:column;box-shadow:0 20px 60px rgba(0,0,0,.3)}
.modal-card header{display:flex;align-items:flex-start;gap:12px;padding:16px 22px;
  border-bottom:1px solid var(--rule)}
.modal-card header h2{font-size:17px;color:var(--stc-navy)}
.modal-body{overflow:auto;padding:16px 22px;font-size:13.4px;line-height:1.55;min-height:0}
.modal-body h3{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--stc-blue);
  margin:16px 0 5px}
.modal-body h3:first-child{margin-top:0}
#zoneList{padding:14px 18px 18px}
#zoneList .zrow{display:flex;align-items:baseline;gap:8px;padding:5px 0;
  border-bottom:1px solid var(--rule);font-size:13px}
#zoneList .zrow:last-child{border-bottom:none}
#zoneList .zname{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#zoneList .zdue{color:var(--ink-soft);font-variant-numeric:tabular-nums}
#zoneList .ztag{font-size:11px;letter-spacing:.05em;text-transform:uppercase;font-weight:600;
  padding:1px 7px;border-radius:9px;white-space:nowrap}
#zoneList .ztag.ok{background:#E7F2E9;color:#2C6B3A}
#zoneList .ztag.due{background:#FDF1DC;color:#8A5A16}
#zoneList .ztag.overdue{background:#FBE3E0;color:#9B2F22}
#zoneList .ztag.never,#zoneList .ztag.unscheduled{background:var(--paper-2,#EEF1F4);color:var(--ink-soft)}
.cd-card{width:min(430px,100%)}
.cd-help{font-size:13px;color:var(--ink-soft);margin:0 0 14px;line-height:1.5}
.cd-field{display:block;font-size:11.5px;letter-spacing:.07em;text-transform:uppercase;
  color:var(--stc-blue);font-weight:600}
.cd-field input{display:block;width:100%;margin-top:6px;padding:10px;font:inherit;
  color:var(--ink);border:1px solid var(--rule);border-radius:5px;background:var(--white)}
.cd-warn{font-size:12.5px;color:#A8501F;margin:11px 0 0;min-height:1.1em}
.modal-body p{margin:0 0 9px}
.modal-fine{font-size:11.5px;color:var(--ink-soft);border-top:1px solid var(--rule);
  padding-top:10px;margin-top:14px!important}
.modal-foot{padding:12px 22px;border-top:1px solid var(--rule);background:var(--stc-mist);
  display:flex;justify-content:flex-end;border-radius:0 0 8px 8px}

/* ── Drawer two-column split ── */
.split{display:grid;grid-template-columns:1fr 1fr;gap:16px;align-items:start}
.split .col-detail .dsec:last-child{margin-bottom:0}
@media(max-width:720px){.split{grid-template-columns:1fr}}

/* ── Photographs ── */
.photo{position:relative;display:block;width:100%;border-radius:5px;overflow:hidden;
  background:#12212A;border:1px solid var(--rule);cursor:zoom-in}
.photo img{width:100%;height:100%;object-fit:contain;display:block}
.photo .count,.photo .zoom{position:absolute;bottom:7px;background:rgba(0,54,73,.85);color:#fff;
  font-size:11px;padding:3px 8px;border-radius:99px;letter-spacing:.02em}
.photo .count{right:7px;font-weight:600}
.photo .zoom{left:7px;opacity:0;transition:opacity .15s}
.photo:hover .zoom{opacity:1}
.thumbs{display:flex;gap:5px;margin-top:5px}
.thumbs button{flex:1;aspect-ratio:1/1;border:1px solid var(--rule);border-radius:4px;
  overflow:hidden;background:#12212A;padding:0;cursor:pointer}
.thumbs button.on{border-color:var(--stc-blue);box-shadow:0 0 0 1px var(--stc-blue)}
.thumbs img{width:100%;height:100%;object-fit:cover;display:block}
.cap{font-size:10.5px;color:var(--ink-soft);margin-top:4px;font-variant-numeric:tabular-nums}
.nophoto{aspect-ratio:3/4;border:1px dashed var(--rule);border-radius:5px;display:grid;
  place-items:center;text-align:center;color:var(--ink-soft);font-size:12.5px;padding:14px;
  background:var(--stc-mist);line-height:1.45}
.nophoto span{display:block;font-size:11.5px;opacity:.8;margin-top:3px}

/* ── Gallery ── */
.gallery{position:fixed;inset:0;z-index:1500;background:rgba(5,20,28,.94);
  display:none;grid-template-rows:minmax(0,1fr) auto}
.gallery.on{display:grid}
/* minmax(0,1fr) above + min-height:0 here stop the row growing to the image's
   natural height, which is what let a tall portrait overflow the viewport. */
.g-stage{display:flex;align-items:center;justify-content:center;
  padding:30px 56px;overflow:hidden;min-height:0}
.g-stage img{max-width:100%;max-height:100%;min-height:0;object-fit:contain;
  border-radius:3px;box-shadow:0 8px 40px rgba(0,0,0,.5)}
.g-bar{display:flex;align-items:center;gap:12px;padding:11px 18px;
  background:rgba(255,255,255,.07);color:#D8E3EA;font-size:12.5px;flex-wrap:wrap}
.g-strip{display:flex;gap:5px;margin-left:auto}
.g-strip img{width:40px;height:40px;object-fit:cover;border-radius:3px;opacity:.5;
  border:1px solid transparent;cursor:pointer}
.g-strip img.on,.g-strip img:hover{opacity:1;border-color:var(--stc-blue)}
.g-close{position:absolute;top:12px;right:16px;background:none;border:none;color:#D8E3EA;
  font-size:32px;line-height:1;cursor:pointer;padding:4px 10px;z-index:2}
.g-close:hover{color:#fff}
.g-nav{position:absolute;top:50%;transform:translateY(-50%);background:rgba(255,255,255,.1);
  border:none;color:#fff;font-size:34px;line-height:1;padding:14px 18px;cursor:pointer;border-radius:5px}
.g-nav:hover{background:rgba(255,255,255,.2)}
.g-nav.prev{left:12px} .g-nav.next{right:12px}

.banner.notdone{background:#F1F3F5;border-left:4px solid #8A9BA5;border-radius:4px;
  padding:8px 12px;margin-bottom:12px;font-size:12.8px;color:#4A5A64}
.btn.sharebtn{flex:0 0 auto}
.btn.warnbtn{color:var(--overdue);border-color:#E7C9CC}
.btn.warnbtn:hover{background:#FDF3F4}

.banner.constraint{background:#FFF4E0;border:1px solid #E8912A;border-left:4px solid #E8912A;
  border-radius:4px;padding:6px 10px;margin:0 0 12px;color:#5A3D0B}
.banner.constraint b{display:block;font-size:12.2px;margin-bottom:1px;color:#7A5205;line-height:1.3}
.banner.constraint p{font-size:11.5px;line-height:1.34;margin:0 0 2px}
.banner.constraint .fine{font-size:9.8px;font-style:italic;opacity:.78;margin:0;line-height:1.3}
.js-constraint{border:1.5px solid #000;border-radius:3px;padding:5px 9px;margin-bottom:7px;
  font-size:9pt;line-height:1.3;background:#FFF4E0}
.js-constraint.soft{border-style:dashed}
.js-c-head{font-weight:700;font-size:9.5pt;margin-bottom:2px;letter-spacing:.01em}
.js-c-fine{font-size:7.5pt;font-style:italic;color:#333;margin:0 0 3px;line-height:1.25}
.empty-title{font-size:15px;font-weight:600;color:var(--stc-navy);margin-bottom:6px}
.empty-detail{font-size:13.5px;color:var(--ink-soft);line-height:1.5;max-width:420px;margin:0 auto}
/* The site list needs its own block context: #gsiButton is display:flex, which
   was right for centring one Google button and turns a stack of full-width
   site buttons into a cramped row. */
.site-list{width:100%;display:block;text-align:left}
.site-scroll{max-height:min(46vh,320px);overflow-y:auto;-webkit-overflow-scrolling:touch;
  margin:0 -2px;padding:0 2px}
.site-scroll.scrolls{border-top:1px solid var(--rule);border-bottom:1px solid var(--rule);
  padding-top:8px;padding-bottom:8px}
.site-filter{display:block;width:100%;margin:0 0 10px;padding:9px 12px;font:inherit;font-size:14px;
  color:var(--ink);border:1px solid var(--rule);border-radius:6px;background:var(--white)}
.site-filter:focus{outline:none;border-color:var(--stc-blue)}
.site-none{font-size:13px;color:var(--ink-soft);padding:10px 2px;text-align:left}
.site-btn{display:block;width:100%;margin:0 0 8px;padding:12px 16px;border:1px solid var(--rule);
  border-radius:6px;background:var(--white);font-size:14.5px;font-weight:600;color:var(--stc-navy);text-align:left}
.site-btn:last-child{margin-bottom:0}
.site-btn:hover{border-color:var(--stc-blue);background:var(--stc-mist)}
.gate-retry{
  background:none;border:1px solid var(--rule);border-radius:99px;padding:6px 14px;
  font-size:12.5px;color:var(--stc-navy);margin-top:12px
}
.masthead h1{font-size:19px;color:var(--stc-navy)}
.masthead .sub{font-size:14.5px;color:var(--stc-navy);margin-top:3px}
.masthead .sub b{font-weight:600}
.spacer{flex:1}
.chip{
  border:1px solid var(--rule);background:var(--white);border-radius:99px;
  padding:6px 14px;color:var(--stc-navy);font-weight:600;font-size:13.5px;
  display:inline-flex;align-items:center;gap:7px;transition:.15s;
}
.chip:hover{border-color:var(--stc-blue);color:var(--stc-blue)}
.chip .n{
  background:var(--stc-blue);color:#fff;border-radius:99px;
  min-width:20px;height:20px;display:grid;place-items:center;font-size:11.5px;padding:0 5px;
}
.chip.quiet .n{background:var(--p-none)}

/* ── Layout ───────────────────────────────────────── */
.wrap{padding:14px 16px;max-width:none;margin:0}
/* Three full-height columns: stats | table | map. Page doesn't scroll; each pane does. */
.panes{
  display:grid;
  grid-template-columns:minmax(340px,0.95fr) minmax(400px,1.15fr) minmax(440px,1.3fr);
  gap:14px;
  height:calc(100vh - var(--masthead-h) - 28px);
}
.pane{min-height:0;display:flex;flex-direction:column}
.pane-stats{gap:14px;overflow:auto;padding-right:2px}
.pane-stats .card{flex-shrink:0}
.pane-table{overflow:hidden;position:relative}
.pane-map{overflow:hidden}
.card{background:var(--white);border:1px solid var(--rule);border-radius:6px;box-shadow:var(--shadow)}
.card>header{
  padding:13px 18px 11px;border-bottom:1px solid var(--rule);
  display:flex;align-items:baseline;gap:10px;
}
.card>header h2{font-size:14px;color:var(--stc-blue);letter-spacing:.02em}
.card>header .note{font-size:12px;color:var(--ink-soft)}
.card>header .mini-clear{margin-left:auto;background:none;border:1px solid var(--rule);border-radius:99px;
  font-size:11.5px;color:var(--ink-soft);padding:3px 11px;transition:.15s;opacity:0;pointer-events:none}
.card>header .mini-clear.on{opacity:1;pointer-events:auto}
.card>header .mini-clear:hover{border-color:var(--stc-blue);color:var(--stc-blue)}

/* ── KPI strip ────────────────────────────────────── */
.kpis{display:grid;grid-template-columns:repeat(5,1fr);border-bottom:1px solid var(--rule)}
.kpi{
  padding:14px 12px 16px;border-right:1px solid var(--rule);
  text-align:left;background:none;border-top:none;border-bottom:none;border-left:none;
  position:relative;transition:.15s;
}
.kpi:last-child{border-right:none}
.kpi-warn{display:block;width:100%;text-align:left;border:none;border-bottom:1px solid #D9C6E6;
  background:#F5EEFA;color:#4F2A66;font-size:12.5px;line-height:1.4;padding:8px 14px}
.kpi-warn[hidden]{display:none}
.kpi-warn:hover,.kpi-warn[aria-pressed="true"]{background:#EADCF4}
.due.unknown{color:#7B3FA0;font-weight:700}
.norec{color:#7B3FA0;font-weight:700}
.kpi:hover{background:var(--stc-mist)}
.kpi[aria-pressed="true"]{background:#EAF3FA}
.kpi[aria-pressed="true"]:after{
  content:"";position:absolute;left:0;right:0;bottom:0;height:3px;background:var(--stc-blue);
}
.kpi .lbl{font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--ink-soft);min-height:28px;display:block}
.kpi .val{font-size:30px;font-weight:300;color:var(--stc-navy);line-height:1.1;margin-top:6px;display:block}
.kpi.hot .val{color:var(--overdue);font-weight:600}
.kpi.zero .val{color:#C3CDD4}

/* ── Bars ─────────────────────────────────────────── */
.bars{padding:14px 18px 18px}
.bar-row{display:grid;grid-template-columns:118px 1fr 40px;align-items:center;gap:10px;margin-bottom:7px}
.bar-row:last-child{margin-bottom:0}
.bar-row .k{font-size:12.5px;color:var(--ink-soft);text-align:right;line-height:1.2}
.bar-track{height:20px;background:var(--stc-mist);border-radius:2px;overflow:hidden}
.bar-fill{height:100%;border-radius:2px;transition:width .5s cubic-bezier(.2,.8,.2,1)}
.bar-row .v{font-size:13px;font-weight:600;color:var(--stc-navy);text-align:right;font-variant-numeric:tabular-nums}
.bar-row .v .pc{display:block;font-size:10px;font-weight:500;color:var(--ink-soft);line-height:1.1}
.bar-row.dim{opacity:.35}
.bar-row.clickable{cursor:pointer}
.bar-row.clickable:hover .bar-track{outline:1px solid var(--stc-blue);outline-offset:1px}

/* ── Map ──────────────────────────────────────────── */
#map{flex:1;min-height:0;border-radius:0;z-index:1}
.pane-map .legend{border-radius:0 0 6px 6px}
.map-tools{margin-left:auto;display:flex;gap:6px}
.map-tools button{background:var(--white);border:1px solid var(--rule);border-radius:99px;
  font-size:12px;color:var(--stc-navy);padding:4px 12px;transition:.15s}
.map-tools button:hover{border-color:var(--stc-blue);color:var(--stc-blue)}
.map-tools button[aria-pressed="true"]{background:var(--stc-blue);color:#fff;border-color:var(--stc-blue)}
.legend{
  display:flex;flex-wrap:wrap;gap:6px 16px;padding:10px 18px;
  border-top:1px solid var(--rule);font-size:12px;color:var(--ink-soft);
}
.legend i{width:10px;height:10px;border-radius:50%;display:inline-block;margin-right:6px;border:1.5px solid #fff;box-shadow:0 0 0 1px rgba(0,0,0,.25)}
.pin{border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px rgba(0,0,0,.35),0 1px 4px rgba(0,0,0,.3)}
.pin.sel{box-shadow:0 0 0 3px var(--stc-blue),0 0 0 5px rgba(4,95,165,.3)}
body.base-aerial .pin.sel{box-shadow:0 0 0 3px #fff,0 0 0 6px rgba(0,0,0,.35)}

/* ── Table ────────────────────────────────────────── */
.toolbar{display:flex;flex-wrap:wrap;gap:8px;padding:12px 18px;border-bottom:1px solid var(--rule);align-items:center}
select,input[type=search]{
  font-family:inherit;font-size:13.5px;padding:6px 9px;border:1px solid var(--rule);
  border-radius:4px;background:var(--white);color:var(--ink);min-width:130px;
}
input[type=search]{min-width:220px}
select:focus,input:focus,button:focus-visible{outline:2px solid var(--stc-blue);outline-offset:1px}
.linkbtn{background:none;border:none;color:var(--stc-blue);font-weight:600;font-size:13px;padding:4px 2px;text-decoration:underline;text-underline-offset:2px}
table{width:100%;border-collapse:collapse;font-size:13.5px}
thead th{
  text-align:left;padding:9px 12px;background:var(--stc-navy);color:#fff;
  font-weight:600;font-size:12px;letter-spacing:.04em;text-transform:uppercase;
  position:sticky;top:0;cursor:pointer;white-space:nowrap;user-select:none;
}
thead th:hover{background:#0A4A61}
thead th .ar{opacity:.45;font-size:10px;margin-left:3px}
tbody td{padding:9px 12px;border-bottom:1px solid var(--rule);vertical-align:top}
tbody tr{cursor:pointer}
tbody tr:hover td{background:#EAF3FA}
tbody tr.sel td{background:#DCEBF7}
.clamp{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;max-width:340px}
.tid{font-weight:700;color:var(--stc-navy);white-space:nowrap}
.tag{
  display:inline-block;padding:2px 8px;border-radius:99px;font-size:11.5px;font-weight:600;
  color:#fff;white-space:nowrap;
}
.due{font-variant-numeric:tabular-nums;white-space:nowrap;font-size:13px}
.due.overdue{color:var(--overdue);font-weight:700}
.due.na{color:var(--ink-soft)}
.tablewrap{flex:1;min-height:0;overflow:auto}
.foot{padding:10px 18px;font-size:12.5px;color:var(--ink-soft);display:flex;gap:14px;align-items:center;border-top:1px solid var(--rule)}
.empty{padding:44px 18px;text-align:center;color:var(--ink-soft)}
.empty b{display:block;color:var(--stc-navy);font-size:15px;margin-bottom:4px}

/* ── Drawer — docked inside the table pane, covers only the table ── */
.scrim{position:absolute;inset:0;background:rgba(0,54,73,.28);opacity:0;pointer-events:none;transition:.2s;z-index:590;border-radius:6px}
.scrim.on{opacity:1;pointer-events:auto}
.drawer{
  position:absolute;inset:0;background:var(--white);
  z-index:600;transform:translateX(100%);transition:transform .25s cubic-bezier(.2,.8,.2,1);
  display:flex;flex-direction:column;box-shadow:-8px 0 32px rgba(0,54,73,.18);
  border-radius:6px;
}
.drawer.on{transform:none}
.drawer header{padding:14px 18px;border-bottom:1px solid var(--rule);display:flex;align-items:flex-start;gap:12px}
.drawer header h2{font-size:19px;color:var(--stc-navy)}
.drawer header .sp{font-size:13.5px;color:var(--ink-soft);font-style:italic}
.x{background:none;border:none;font-size:22px;color:var(--ink-soft);line-height:1;padding:2px 6px;margin-left:auto}
.x:hover{color:var(--stc-navy)}
.dbody{overflow:auto;padding:18px 20px;flex:1}
.dsec{margin-bottom:20px}
.dsec h3{
  font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--stc-blue);
  padding-bottom:5px;border-bottom:1px solid var(--rule);margin-bottom:9px;
}
.kv{display:grid;grid-template-columns:132px 1fr;gap:4px 12px;font-size:13.5px}
.kv dt{color:var(--ink-soft)}
.kv dd{margin:0;color:var(--ink)}
.prose{font-size:13.5px;line-height:1.5}
.qtra{display:flex;gap:8px;margin-top:4px}
.qtra div{flex:1;text-align:center;border:1px solid var(--rule);border-radius:4px;padding:7px 4px;background:var(--stc-mist)}
.qtra .q{font-size:10px;text-transform:uppercase;letter-spacing:.05em;color:var(--ink-soft)}
.qtra .n{font-size:19px;font-weight:600;color:var(--stc-navy)}
.dfoot{padding:14px 20px;border-top:1px solid var(--rule);display:flex;gap:10px;background:var(--stc-mist);align-items:center}
.await{flex:1;text-align:center;font-size:13px;color:var(--ink-soft);font-style:italic}
.btn{
  flex:1;padding:11px 14px;border-radius:4px;font-weight:600;font-size:14px;border:1px solid transparent;
  transition:.15s;
}
.btn.primary{background:var(--stc-blue);color:#fff}
.btn.primary:hover{background:#03528F}
.btn.ghost{background:var(--white);color:var(--stc-navy);border-color:var(--rule)}
.btn.ghost:hover{border-color:var(--stc-navy)}
.btn.undo{background:var(--white);color:var(--p-urgent);border-color:var(--p-urgent)}
.banner{
  padding:10px 14px;border-radius:4px;font-size:13.5px;margin-bottom:16px;
  background:#FFF6DC;border:1px solid #F2B705;color:#6B4E00;
}
.banner.done{background:#E7F5EA;border-color:var(--p-low);color:#1F5C2C}

/* ── Toast ────────────────────────────────────────── */
.toast{
  position:fixed;bottom:24px;left:50%;transform:translate(-50%,80px);
  background:var(--stc-navy);color:#fff;padding:12px 20px;border-radius:5px;
  font-size:14px;z-index:1100;opacity:0;transition:.25s;box-shadow:0 6px 24px rgba(0,54,73,.3);
  display:flex;align-items:center;gap:14px;
}
.toast.on{opacity:1;transform:translate(-50%,0)}
.toast button{background:none;border:none;color:#7EC4F0;font-weight:600;text-decoration:underline}

/* ── Job sheet (print) ────────────────────────────── */
#sheets{display:none}
@page{size:A4;margin:0}
@media print{
  /* The three-pane screen layout clips html/body; that must not apply to print,
     or every job sheet renders into one clipped page. (Trap 21.) */
  html,body{height:auto!important;overflow:visible!important}
  body{background:#fff}
  *{-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important}
  .masthead,.wrap,.drawer,.scrim,.toast,.modal,.gallery{display:none!important}
  #sheets{display:block}
  /* min-height:297mm is only there to make a short sheet look like a full page
     on screen. In print it forces a short sheet to exactly one A4 height, so any
     margin the browser applies pushes a few mm onto a phantom second page.
     Drop it for print: short sheets then occupy only the height they need. */
  .js-page{page-break-after:always;break-after:page;min-height:0}
  .js-page:last-child{page-break-after:auto;break-after:auto;page-break-after:avoid}
  #sheets{overflow:visible}
  /* Nothing after the last sheet may generate a box. */
  body>*:not(#sheets){display:none!important}
}
.js-page{
  width:210mm;min-height:297mm;padding:16mm 15mm;background:#fff;margin:0 auto;
  font-size:11pt;color:#000;
}
.js-head{display:flex;align-items:center;gap:12px;border-bottom:2.5px solid var(--stc-blue);padding-bottom:9px;margin-bottom:13px}
.js-head .t{font-size:15pt;font-weight:700;color:var(--stc-navy);line-height:1.2}
.js-head .s{font-size:9pt;color:#555;line-height:1.35}
.js-head .js-logo{margin-left:auto;height:13mm;width:auto}
.js-bignum{
  border:2px solid var(--stc-navy);border-radius:4px;padding:5px 12px;text-align:center;min-width:22mm;
}
.js-bignum .a{font-size:8pt;letter-spacing:.08em;text-transform:uppercase;color:#666}
.js-bignum .b{font-size:19pt;font-weight:700;color:var(--stc-navy);line-height:1.15}

/* KPI summary (A1) — printed, like the job sheets */
.kpi-dates{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.kpi-page{font-size:9pt;line-height:1.32;padding:12mm 14mm}
.kpi-page .js-head{margin-bottom:8px;padding-bottom:6px}
.kpi-page .js-head .js-logo{height:10mm}
.kpi-scope{font-size:8.6pt;color:#333;background:#F3F6F8;border-left:3px solid var(--stc-blue);padding:5px 9px;margin:0 0 9px}
.kpi-sec{margin:0 0 7px}
.kpi-sec h2{font-size:10.4pt;color:var(--stc-navy);margin:0 0 3px;border-bottom:1px solid #BBC;padding-bottom:2px;
  display:flex;gap:8px;align-items:baseline;break-after:avoid;page-break-after:avoid}
.kpi-sec h2 .tgt{margin-left:auto;font-size:8.4pt;font-weight:600;color:#555;letter-spacing:.02em}
.kpi-res{margin:3px 0 4px;font-weight:600}
.kpi-res.ok{color:#1E6B34}
.kpi-res.miss{color:#A01010}
.kpi-res.none{color:#555;font-weight:500}
.kpi-page table{width:100%;border-collapse:collapse;margin:2px 0 3px;font-size:8.4pt}
/* The register table's header and row styles are not wanted here */
.kpi-page thead th{text-align:left;font-weight:600;font-size:8pt;color:#444;background:none;text-transform:none;letter-spacing:0;
  position:static;cursor:default;white-space:normal;border-bottom:1px solid #999;padding:1px 5px 1px 0}
.kpi-page tbody td{border-bottom:.5px solid #DDD;padding:1px 5px 1px 0;vertical-align:top}
.kpi-page tbody tr{cursor:default}
.kpi-page tbody tr:hover td{background:none}
.kpi-page td.n,.kpi-page thead th.n{text-align:right;padding-right:10px;white-space:nowrap}
.kpi-page tr{break-inside:avoid;page-break-inside:avoid}
.kpi-page tbody .x-row td{color:#7A0D0D}
.kpi-page .sub{color:#666;font-size:8pt}
.kpi-note{font-size:8.4pt;color:#444;margin:2px 0}
.kpi-basis{font-size:8.2pt;color:#333;margin:0;padding-left:15px}
.kpi-basis li{margin:0 0 2px}

/* Static aerial extract for the job sheet */
.js-splitmap{display:grid;grid-template-columns:0.92fr 1fr;gap:0 18px;margin-bottom:11px;align-items:start}
.js-visual{display:grid;gap:0 9px;margin-bottom:9px;align-items:start}
.js-visual.solo{grid-template-columns:1fr}
.js-visual .js-photo{height:var(--vh,70mm);border:1px solid #BBB;border-radius:3px;overflow:hidden;
  background:#fff;line-height:0}
.js-visual .js-photo img{width:100%;height:100%;object-fit:contain;display:block}
.js-visual .smap{width:100%;height:var(--vh,70mm);aspect-ratio:auto}
.js-visual .smap svg{width:100%;height:100%;display:block}
.js-datarow{display:grid;grid-template-columns:1fr 1fr;gap:0 26px;margin-bottom:9px;align-items:stretch}
/* A rule between the two halves, since they no longer have their own boxes. */
.js-datarow .js-cell + .js-cell{border-left:1px solid #CCC;padding-left:26px}
.js-cellbody{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}
.js-cellbody .js-kv{margin-bottom:0;flex:1}
/* Drop the QR to sit on the text baseline rather than riding above it. */
.js-cellbody .js-qrnest{margin-top:3px}
.js-splitmap .smap{width:100%;height:60mm;aspect-ratio:auto}

.js-splitmap .smap svg{width:100%;height:100%;display:block}
.js-sub{display:flex;justify-content:space-between;align-items:flex-end;gap:10px}
.js-sub-top{align-items:flex-start}
.js-sub .js-kv{flex:1}
.js-qrnest{text-align:center;flex-shrink:0}
.js-qrnest .js-qrlbl{margin-top:2px;line-height:1.15}
.js-qr{display:flex;gap:16px;margin-top:9px}
.js-qr>div{text-align:center}
.js-qrcode{border:1px solid #ddd;border-radius:3px;padding:3px;background:#fff;line-height:0}
.js-qrlbl{font-size:7.5pt;color:#555;margin-top:3px}
.smap{overflow:hidden;border:1px solid #BBB;border-radius:3px;background:#DDD;line-height:0;aspect-ratio:var(--ar,1/1)}
.smap svg{width:100%;height:100%;display:block}
.smap-cap{font-size:7.5pt;color:#777;margin-top:3px;display:flex}
.smap-cap span:last-child{margin-left:auto}
.js-band{padding:6px 12px;color:#fff;font-weight:700;font-size:10.5pt;border-radius:3px;margin-bottom:9px}
.js-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 22px;margin-bottom:14px}
.js-h{font-size:9pt;text-transform:uppercase;letter-spacing:.07em;color:var(--stc-blue);border-bottom:1px solid #CCC;padding-bottom:3px;margin:0 0 6px}
.js-kv{display:grid;grid-template-columns:auto 1fr;gap:3px 10px;font-size:10.5pt;margin-bottom:14px}
.js-kv dt{color:#666}
.js-kv dd{margin:0;font-weight:600}
.js-box{border:1px solid #CCC;border-radius:3px;padding:8px 12px;margin-bottom:8px;font-size:10.5pt;line-height:1.4}
.js-box.act{border:2px solid var(--stc-navy);background:#F7FAFC}
.js-box.act .js-h{color:var(--stc-navy);border-color:#AAB;font-size:10pt}
.js-sign{border:1px solid #CCC;border-radius:3px;padding:9px 11px;font-size:9.5pt}
.js-signnote{font-size:9pt;color:#555;margin-bottom:16px;line-height:1.35}
/* Label and rule on one line, so there is room to actually write on it. */
.js-sigrow{display:grid;grid-template-columns:1fr 1fr 1fr;gap:14px;align-items:baseline}
.js-sigrow > div{display:flex;align-items:baseline;gap:6px}
.js-sigrow span{font-size:8pt;color:#555;white-space:nowrap}
.js-sigline{flex:1;border-bottom:1px solid #999;height:0;display:block}
.js-line{display:flex;gap:16px;margin-top:10px}
.js-line div{flex:1;border-bottom:1px solid #000;padding-bottom:2px;font-size:8.5pt;color:#777}
.js-line div span{display:block;height:22px}
.js-foot{margin-top:18px;padding-top:8px;border-top:1px solid #CCC;font-size:8pt;color:#777;display:flex}
.js-foot span:last-child{margin-left:auto}

/* ── Tablet: two columns, map+table share the lower row ── */
@media(max-width:1200px){
  html,body{overflow:auto}
  .panes{grid-template-columns:1fr 1fr;height:auto;min-height:0}
  .pane-stats{grid-column:1 / -1;overflow:visible}
  .pane-map,.pane-table{height:70vh}
}

/* ── Mobile: single column, everything stacks and the page scrolls ── */
@media(max-width:720px){
  .wrap{padding:10px}
  .panes{grid-template-columns:1fr;gap:12px;height:auto}
  /* stack panes to content height, EXCEPT the map which needs an explicit height to render */
  .pane-stats,.pane-table{height:auto}
  .pane-map{height:56vh;min-height:300px}
  #map{height:100%;flex:none}
  .pane-stats{overflow:visible}
  .kpis{grid-template-columns:repeat(5,minmax(0,1fr))}
  .kpi{padding:12px 6px 14px}
  .kpi .val{font-size:22px}
  .kpi .lbl{font-size:9.5px;letter-spacing:.02em;min-height:42px}
  .pane-table{max-height:none}
  .tablewrap{max-height:60vh}
  /* On mobile the drawer covers the whole screen — it's the primary view when arriving via a QR link */
  .drawer{position:fixed;inset:0;border-radius:0;z-index:1200;width:100%}
  /* The STC view carries four buttons; a flex row makes them all different
     widths. A two-column grid gives every role the same, even layout. */
  .dfoot{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:12px 14px}
  .dfoot .btn{flex:none;width:100%;padding:12px 10px;font-size:13.5px;
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .dfoot .btn.sharebtn{flex:none}
  /* An odd number of buttons: the last one spans the full width rather than
     leaving a ragged half-row. */
  .dfoot .btn:last-child:nth-child(odd){grid-column:span 2}
  .dfoot .await{grid-column:span 2;text-align:center}
  .scrim{position:fixed;z-index:1190}
  /* Masthead: allow it to grow and wrap rather than clip the logo off-screen */
  .masthead{padding:10px 14px;gap:10px 12px;height:auto;flex-wrap:wrap}
  .masthead h1{font-size:16px}
  .masthead .sub{font-size:12px}
  .masthead .logo{height:28px;margin-left:auto;padding-left:0;border-left:none}
  .masthead .chip{padding:5px 10px;font-size:12px}
}
@media(max-width:420px){
  /* very narrow: title full width, controls on their own wrapped row */
  .masthead h1{font-size:15px}
  .masthead .logo{height:26px}
  .kpis{grid-template-columns:repeat(5,minmax(0,1fr))}
  .kpi .lbl{font-size:9px}
}
@media(prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
