/* CX job portal: mobile-first. The one bold element is the green route sign. */
:root {
  --paper:   #EDF0F3;
  --surface: #FFFFFF;
  --ink:     #19212B;
  --muted:   #5B6775;
  --line:    #D3DAE1;
  --sign:    #00653A;   /* UK primary-route green */
  --sign-ink:#FFFFFF;
  --sign-pc: #FFD200;   /* primary-route yellow */
  --action:  #1D4F91;
  --action-ink: #FFFFFF;
  --go:      #00653A;
  --warn-bg: #FCE8E6;  --warn: #A1251B;
  --note-bg: #FFF4CC;  --note: #6B5200;
  --radius: 10px;
  color-scheme: light dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12171D; --surface: #1B222B; --ink: #E7ECF1; --muted: #9BA7B4; --line: #2D3742;
    --sign: #0A6E41; --action: #5E95E0; --action-ink: #0F1720; --go: #2E9E68;
    --warn-bg: #3A1D1B; --warn: #FFB4AB; --note-bg: #362D0F; --note: #F3D77A;
  }
}
*, *::before, *::after { box-sizing: inherit; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.5 "Atkinson Hyperlegible", "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
main { max-width: 44rem; margin: 0 auto; padding: 1rem 1rem 3rem; }
a { color: var(--action); }
:focus-visible { outline: 3px solid var(--sign-pc); outline-offset: 2px; }

/* ---- top bar */
.bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem 1rem; background: var(--sign); color: var(--sign-ink);
}
.brand { color: inherit; font-weight: 700; text-decoration: none; letter-spacing: .01em; }
.bar-out { display: flex; align-items: center; gap: .75rem; margin: 0; font-size: .9rem; }
.bar .who { opacity: .85; }
.bar .link { color: inherit; }

/* ---- type */
h1, h2 { line-height: 1.2; margin: 0 0 .5rem; }
.page-title { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.25rem; color: var(--muted); }
.flash   { background: var(--surface); border-left: 4px solid var(--go); padding: .7rem 1rem; border-radius: 6px; }
.error   { background: var(--warn-bg); color: var(--warn); padding: .7rem 1rem; border-radius: 6px; }
.notice  { background: var(--note-bg); color: var(--note); padding: .7rem 1rem; border-radius: 6px; }
.back { margin: 0 0 .75rem; }
.back a::before { content: "‹ "; }

/* ---- buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 1.1rem; border: 0; border-radius: 8px;
  background: var(--action); color: var(--action-ink);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn-quiet { background: transparent; color: var(--action); box-shadow: inset 0 0 0 2px var(--action); }
.btn-go { background: var(--go); color: #fff; width: 100%; min-height: 60px; font-size: 1.2rem; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--action); text-decoration: underline; cursor: pointer; }
input, select {
  width: 100%; min-height: 48px; padding: .5rem .75rem; margin-top: .3rem;
  font: inherit; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: 8px;
}
input:focus, select:focus { border-color: var(--action); outline: none; }
label { display: block; font-weight: 700; font-size: .95rem; }
.stack { display: grid; gap: 1rem; }
.narrow { max-width: 26rem; }
.inline { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin: .6rem 0 0; }
.inline input { flex: 1 1 12rem; margin: 0; }

.login { max-width: 24rem; margin: 2rem auto; }
.login h1 { font-size: 2rem; }

/* ---- route sign: the signature element */
.sign {
  position: relative;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem;
  background: var(--sign); color: var(--sign-ink);
  border-radius: var(--radius);
  padding: .75rem .9rem;
  box-shadow: inset 0 0 0 3px var(--sign), inset 0 0 0 5px rgba(255,255,255,.9);
}
.sign .leg { min-width: 0; display: flex; flex-direction: column; }
.sign .leg:last-child { text-align: right; }
.sign .pc { color: var(--sign-pc); font-weight: 700; font-size: 1.35rem; letter-spacing: .02em; white-space: nowrap; }
.sign .co { font-size: .85rem; opacity: .92; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sign .arrow {
  width: 2.2rem; height: 3px; background: var(--sign-ink); position: relative; margin-top: -1.1rem;
}
.sign .arrow::after {
  content: ""; position: absolute; right: -2px; top: -5px;
  border-left: 10px solid var(--sign-ink); border-top: 6.5px solid transparent; border-bottom: 6.5px solid transparent;
}
.sign-lg { padding: 1.1rem 1.1rem; margin: .75rem 0 1rem; }
.sign-lg .pc { font-size: clamp(1.5rem, 6.5vw, 2.1rem); }
.sign-lg .co { font-size: .95rem; }

/* ---- job list */
.jobs { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.job {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border-radius: var(--radius); padding: .8rem;
  border: 1px solid var(--line);
}
a.job:active { transform: scale(.995); }
.job-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.when { font-weight: 700; color: var(--ink); text-decoration: none; }
.job-meta { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: .6rem 0 0; color: var(--muted); font-size: .92rem; }
.reg { font-weight: 700; color: var(--ink); background: var(--sign-pc); color: #19212B; padding: 0 .4rem; border-radius: 4px; }
.amended { color: var(--note); font-weight: 700; }
.done { margin-top: 1.5rem; }
.done summary { cursor: pointer; color: var(--muted); padding: .5rem 0; }
.jobs-done .sign { filter: saturate(.25); }

.chip { font-size: .8rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; border: 1.5px solid currentColor; }
.chip-unallocated { color: var(--warn); }
.chip-allocated   { color: var(--action); }
.chip-collected   { color: var(--go); }
.chip-delivered   { color: var(--muted); }
.chip-cancelled   { color: var(--warn); text-decoration: line-through; }

/* ---- job detail */
.job-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.stop { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .9rem; }
.stop h2 { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: baseline; }
.stop-when { font-weight: 400; color: var(--muted); font-size: 1rem; }
.stop-co { font-weight: 700; margin: .25rem 0 0; }
.stop-addr { margin: .1rem 0 .4rem; }
.stop-contact { margin: 0 0 .75rem; color: var(--muted); }
.stop-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.stop-actions .btn { flex: 1 1 10rem; }
.progress { margin: 1.2rem 0 1.2rem; }
.progress + .undo { margin-top: -.6rem; }
.nw { white-space: nowrap; }
.undo { text-align: center; margin: 0 0 1.5rem; font-size: .9rem; }

.facts { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.facts dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; }
.conditions { margin-top: .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.conditions summary { cursor: pointer; font-weight: 700; }
.conditions p { color: var(--muted); font-size: .95rem; }

/* ---- office */
.tabs { display: flex; gap: .25rem; overflow-x: auto; margin: -.25rem 0 1rem; border-bottom: 2px solid var(--line); }
.tabs a { padding: .7rem .9rem; text-decoration: none; color: var(--muted); font-weight: 700; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--sign); }
.count { display: inline-block; min-width: 1.4rem; padding: 0 .35rem; border-radius: 999px; background: var(--warn); color: var(--surface); font-size: .8rem; text-align: center; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.admin-job.needs { border-left: 5px solid var(--warn); }
.allocate { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .8rem; align-items: end; }
.allocate .wide { grid-column: 1 / -1; }
.allocate .btn { grid-column: 1 / -1; }
@media (min-width: 40rem) {
  .allocate { grid-template-columns: 1.3fr 1fr auto; }
  .allocate .wide { grid-column: 1 / 3; }
  .allocate .btn { grid-column: auto; }
}
.people { list-style: none; padding: 0; margin: 0 0 2rem; display: grid; gap: .5rem; }
.people li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; }
.people li.inactive { opacity: .6; }
.people summary { cursor: pointer; color: var(--action); font-size: .92rem; margin-top: .3rem; }
.held { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.held pre { white-space: pre-wrap; font-size: .85rem; max-height: 20rem; overflow: auto; background: var(--paper); padding: .75rem; border-radius: 6px; }
.log { width: 100%; border-collapse: collapse; font-size: .9rem; display: block; overflow-x: auto; }
.log th, .log td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.grow { flex: 1 1 12rem; }

/* ---- mailbox status */
.mailstatus { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem;
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--go);
  border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1rem; }
.mailstatus.bad { border-left-color: var(--warn); }
.mailstatus > div { display: flex; flex-direction: column; min-width: 0; }
.mailstatus .small { color: var(--muted); }
.mailstatus.bad .small { color: var(--warn); }
.mailstatus form { margin: 0; }
.fetchlog { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 1rem; margin: -.4rem 0 1rem; }
.fetchlog summary { cursor: pointer; font-weight: 700; }
.fetchlog pre { white-space: pre-wrap; font-size: .85rem; margin: .5rem 0 0; }

/* ---- map, pins, van */
.mapbox { margin: 0 0 1rem; }
.jobmap { height: 18rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); z-index: 0; }
@media (min-width: 40rem) { .jobmap { height: 22rem; } }
.leaflet-container { font: inherit; }
.pin { background: none; border: 0; }
.pin span {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
  font-weight: 700; font-size: 1rem;
}
.pin-pickup span   { background: var(--sign); color: var(--sign-pc); }
.pin-delivery span { background: var(--sign-pc); color: #19212B; }
.pin span b { transform: rotate(45deg); line-height: 1; }
.vanpin { background: none; border: 0; }
.vanpin i {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--action); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--action), 0 1px 4px rgba(0,0,0,.4);
}
.vanpin span {
  position: absolute; left: 22px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; background: var(--action); color: #fff; font-weight: 700; font-size: .78rem;
  padding: .12rem .4rem; border-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.vaninfo { margin: .5rem 0 0; font-weight: 700; }
.vaninfo.muted { font-weight: 400; }
.vanline { margin: .55rem 0 0; font-weight: 700; color: var(--action); font-size: .92rem; }
.vanline.muted { color: var(--muted); font-weight: 400; }
.pinsave { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .6rem 0 0;
  background: var(--note-bg); color: var(--note); padding: .5rem .75rem; border-radius: 8px; }
.pinsave[hidden] { display: none; }

/* ---- alerts */
.alerts { margin-top: .9rem; }
.alertlog { list-style: none; padding: 0; margin: 0 0 .8rem; font-size: .92rem; }
.alertlog li { padding: .25rem 0 .25rem 1.2rem; position: relative; }
.alertlog li::before { content: ""; position: absolute; left: 0; top: .7rem; width: .55rem; height: .55rem; border-radius: 50%; background: var(--go); }
.alertlog li.fail { color: var(--warn); }
.alertlog li.fail::before { background: var(--warn); }
.nomargin { margin: 0; }
.warntext { color: var(--warn); }
