/* Apex Site Jobs. Calm, high contrast for direct sun, big targets for gloves. */
/* Fonts are served from our own domain (latin subset only), copied from the @fontsource
   packages at build time. No third-party font requests. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/fonts/archivo-latin-400-normal.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url("/fonts/archivo-latin-600-normal.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("/fonts/archivo-latin-700-normal.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 800;
  src: url("/fonts/archivo-latin-800-normal.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url("/fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --bg: #f4f7f6;
  --card: #ffffff;
  --sunk: #eef3f2;
  --ink: #0d1413;
  --muted: #45524f;
  /* Lines and borders strong enough to hold their shape in glare. */
  --line: rgba(13, 20, 19, 0.28);
  --teal: #13969a;
  /* Filled buttons and picked chips: the brand teal, one step deeper so white text
     passes 4.5:1 in direct sun. */
  --teal-fill: #0c7c80;
  --teal-ink: #08656a;
  --teal-soft: #dcefee;
  --on-teal: #ffffff;
  --done: #5f6d6a;
  /* Status colours, each at least 5:1 on its own background. */
  --bad: #a8231b;
  --bad-soft: #fbe9e7;
  --wait: #8a4f00;
  --wait-soft: #fdf1dc;
  --good: #17703f;
  --good-soft: #e2efe7;
  --off: #d3dad8;
  --on-off: #2b3533;
  --radius: 12px;
  --tap: 52px;
  --f-body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1111;
    --card: #131c1c;
    --sunk: #0f1717;
    --ink: #eef4f2;
    --muted: #a9bab7;
    --line: rgba(238, 244, 242, 0.3);
    --teal: #3cc2c5;
    --teal-fill: #3cc2c5;
    --teal-ink: #7fdcde;
    --teal-soft: #15393b;
    --on-teal: #031c1d;
    --done: #8d9c99;
    --bad: #f58a80;
    --bad-soft: #3a1714;
    --wait: #eaa64a;
    --wait-soft: #33240c;
    --good: #6bd197;
    --good-soft: #10301f;
    --off: #2c3736;
    --on-off: #c9d4d2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1111;
  --card: #131c1c;
  --sunk: #0f1717;
  --ink: #eef4f2;
  --muted: #a9bab7;
  --line: rgba(238, 244, 242, 0.3);
  --teal: #3cc2c5;
  --teal-fill: #3cc2c5;
  --teal-ink: #7fdcde;
  --teal-soft: #15393b;
  --on-teal: #031c1d;
  --done: #8d9c99;
  --bad: #f58a80;
  --bad-soft: #3a1714;
  --wait: #eaa64a;
  --wait-soft: #33240c;
  --good: #6bd197;
  --good-soft: #10301f;
  --off: #2c3736;
  --on-off: #c9d4d2;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.45 var(--f-body);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
h1,
h2,
p {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}
.mono {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
}
.muted {
  color: var(--muted);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* App shell */
.app {
  height: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--card);
}
/* Logo, status pill and name on one row of fixed height, so a status never pushes the page.
   The teal rule makes the app recognisably Apex without a coloured header. */
.head {
  flex: none;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
  min-height: calc(52px + env(safe-area-inset-top, 0px));
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;
  border-bottom: 4px solid var(--teal);
}
.logo {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  line-height: 1;
}
.logo .blk {
  position: absolute;
  left: -4px;
  top: 2px;
  width: 58%;
  height: 70%;
  background: var(--teal);
}
.logo .a {
  position: relative;
  font: 800 1.25rem/1 var(--f-body);
  letter-spacing: -0.03em;
}
.logo .p {
  position: relative;
  font: 500 0.5625rem/1 var(--f-body);
  align-self: flex-end;
  margin-top: 2px;
}
.who {
  grid-column: 3;
  max-width: 9.5em;
  font-size: 1rem;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* On screens with nothing unsaved the name opens Log out: underlined, with a thumb-sized tap
   target that doesn't change the header's height. */
.who[href] {
  text-decoration: underline;
  text-underline-offset: 3px;
  padding-block: 12px;
  margin-block: -12px;
}
/* The crew member's own screen: who is logged in, Change your PIN and Log out. */
.account {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.account .h2 {
  margin-top: 16px;
  font-size: 1.25rem;
}
/* The status pill: short words only ("No signal", "1 waiting"). */
.status {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--wait-soft);
  color: var(--wait);
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
}
.status:empty {
  visibility: hidden;
}
/* position: relative keeps absolutely placed hidden inputs (the photo pickers) inside this
   scroller; without it they made the page itself taller than the phone, so it scrolled into a
   blank grey area and the header slid off. */
.main {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.pad {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.h1 {
  font: 700 1.375rem/1.2 var(--f-body);
  letter-spacing: -0.01em;
}

/* Tab bar */
.tabs {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  padding: 4px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--card);
}
.tabs a {
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-radius: 10px;
}
.tabs svg {
  width: 24px;
  height: 24px;
}
.tabs a[aria-current="page"] {
  color: var(--ink);
}
.tabs a[aria-current="page"]::after {
  content: "";
  width: 20px;
  height: 3px;
  border-radius: 2px;
  background: var(--teal);
}

/* Buttons */
.btn {
  min-height: var(--tap);
  padding: 12px 18px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
a.btn {
  display: grid;
  place-items: center;
  text-decoration: none;
  color: var(--ink);
}
.btn.primary,
a.btn.primary {
  background: var(--teal-fill);
  border-color: var(--teal-fill);
  color: var(--on-teal);
}
.btn.block {
  width: 100%;
}
/* Disabled reads as solid grey in sun, never as a faded primary that looks broken. */
.btn:disabled,
.btn.primary:disabled {
  background: var(--off);
  border-color: var(--off);
  color: var(--on-off);
  cursor: default;
}
/* Destructive actions: red outline and text. */
.btn.danger {
  border-color: var(--bad);
  color: var(--bad);
}
.btn.danger.solid {
  background: var(--bad);
  color: var(--card);
}
.link {
  min-height: 48px;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--teal-ink);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.login-form {
  flex: 1;
  display: flex;
  flex-direction: column;
}
/* Bottom action bar, in thumb reach */
.foot {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg {
  font-size: 1rem;
  font-weight: 600;
}
.msg.bad {
  color: var(--bad);
}
.msg.wait {
  color: var(--wait);
}
/* "Replace theirs" in the amber clash note, well away from the main button. Cancel takes its
   place while the form shows this crew's own works. */
.replace-slot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 6px;
}
.replace-slot .msg {
  flex: 1 1 12em;
}
/* The first thing still missing, under "Job done". */
/* A fixed one-line slot, blank when there's nothing to say, so the button above it never
   moves when the hint comes or goes. Long text is cut short rather than wrapping. */
.hint {
  height: 1.45em;
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Something this phone couldn't send, or a send to check again. */
.note,
.unsent {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border: 2px solid var(--bad);
  border-radius: var(--radius);
}
/* A check, not an alarm: a clash the owner allows, or works saved on this phone. */
.note.wait {
  border-color: var(--wait);
  background: var(--wait-soft);
}
.unsent-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 4px;
  color: var(--bad);
  font-weight: 600;
  text-decoration: none;
}
.unsent-row strong {
  text-decoration: underline;
}

/* Tags */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.tag.done {
  background: var(--good-soft);
  color: var(--good);
}
.tag.wait {
  background: var(--wait-soft);
  color: var(--wait);
}
.tag.site {
  background: var(--teal-soft);
  color: var(--teal-ink);
}
.tag.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

/* Job photos: previews on the form, each with Remove; Take photo and Choose photo side by side. */
.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.photo-grid li {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.photo-thumb {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}
.photo-thumb.small {
  width: 56px;
  height: 56px;
}
.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.photo-actions .btn {
  flex: 1 1 9em;
}
/* Where each photo is: Waiting, Uploaded or Needs retry. */
.photo-states {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}
.photo-states li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
/* Every crew's uploaded photos on the job: who and when under each, tap for full size. */
.photo-strip .photo-grid li {
  width: 96px;
}
.photo-who {
  line-height: 1.3;
}
/* A thumbnail that opens the photo full size. */
.photo-open {
  padding: 0;
  border: 0;
  background: none;
  border-radius: var(--radius);
  cursor: pointer;
}
/* The photo full size, over the page, with who and when and Close in thumb reach. */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(0, 0, 0, 0.92);
  color: #fff;
}
.viewer img {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: contain;
}
.viewer-who {
  font-weight: 600;
}
/* Delete on a crew member's own photo: readable on the dark overlay. */
.viewer .msg {
  color: #fff;
}
.viewer .msg.bad {
  color: #ffb4a8;
}
.viewer .btn {
  border-color: #fff;
  color: #fff;
}
.viewer .btn.danger {
  border-color: #ffb4a8;
  color: #ffb4a8;
}
.viewer .btn.danger.solid {
  background: #ffb4a8;
  color: #000;
}
.viewer .btn.primary {
  border-color: var(--teal-fill);
  color: var(--on-teal);
}
.saved-photos:empty {
  display: none;
}
/* Chris's history: each save's photos, opening full size. */
.photo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
/* The box title stays on one line at 360 px; the tag beside it keeps its normal case. */
.pre .ttl > span:first-child {
  white-space: nowrap;
}
.pre .ttl .tag {
  text-transform: none;
  letter-spacing: 0;
}

/* Jobs list */
.list {
  display: flex;
  flex-direction: column;
}
.job {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  min-height: 72px;
  padding: 12px 4px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  text-align: left;
  cursor: pointer;
  width: 100%;
  color: inherit;
  text-decoration: none;
}
.job .addr {
  font-weight: 700;
  font-size: 1.125rem;
}
.job .dist {
  font: 600 1.125rem var(--f-mono);
  text-align: right;
}
.job .meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  font-size: 1rem;
  color: var(--muted);
}
.headrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 12px;
}
.groups,
.group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.groups {
  gap: 20px;
}
.grouph {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
/* The folded Done group: one row that opens on tap. */
.fold {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 56px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
.fold .chev {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
}
.fold[aria-expanded="true"] .chev {
  transform: rotate(90deg);
}

/* Ausgrid box */
.pre {
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pre .ttl {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px 8px;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
  font-size: 1rem;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

/* Works form */
.q {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lab {
  font-weight: 700;
}
.chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.chip {
  min-height: var(--tap);
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
/* One "picked" style for chips, segments and toggles: teal fill, white text. Chips also get a
   tick, so picked never relies on colour alone. */
.chip[aria-pressed="true"],
.seg button[aria-pressed="true"],
.toggle[aria-pressed="true"] {
  background: var(--teal-fill);
  border-color: var(--teal-fill);
  color: var(--on-teal);
}
.chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.chip[aria-pressed="true"]::before {
  content: "";
  flex: none;
  width: 6px;
  height: 12px;
  margin-top: -3px;
  border: solid currentColor;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
/* The other crew's pick after a clash, marked with their initial. */
.chip .mark {
  position: absolute;
  top: -8px;
  right: -6px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--wait-soft);
  color: var(--wait);
  border: 2px solid var(--wait);
  font: 700 0.875rem/20px var(--f-body);
}
.follow {
  scroll-margin-bottom: 96px;
  border-left: 4px solid var(--teal);
  padding: 2px 0 2px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.follow h3 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--teal-ink);
}
.sub {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 1rem;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.sub legend {
  padding: 0;
  margin-bottom: 6px;
}
.seg {
  display: flex;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.seg button {
  flex: 1;
  min-height: var(--tap);
  border: 0;
  background: var(--card);
  font: 600 1.0625rem var(--f-mono);
  cursor: pointer;
  touch-action: manipulation;
}
.seg.words button {
  font-family: var(--f-body);
  font-size: 1rem;
}
.seg button + button {
  border-left: 2px solid var(--line);
}
.stepper {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.stepper button {
  width: 64px;
  height: var(--tap);
  border: 0;
  background: var(--card);
  font-size: 1.5rem;
  cursor: pointer;
  touch-action: manipulation;
}
.stepper button:disabled {
  color: var(--done);
  cursor: default;
}
.stepper output {
  min-width: 48px;
  text-align: center;
  font: 600 1.25rem var(--f-mono);
}
.dr {
  background: var(--sunk);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Text fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
}
.field input,
.field textarea,
.field select {
  min-height: var(--tap);
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-weight: 400;
  font-size: 1.0625rem;
  min-width: 0;
}
.field input:focus,
.field textarea:focus {
  border-color: var(--teal);
}
.row {
  display: flex;
  gap: 10px;
}
.row > * {
  flex: 1;
  min-width: 0;
}

/* Saved */
.saved {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 16px;
}
.tick {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--teal-fill);
  color: var(--on-teal);
  display: grid;
  place-items: center;
}
.tick svg {
  width: 44px;
  height: 44px;
}
.tick.clock {
  background: var(--wait-soft);
  color: var(--wait);
  border: 3px solid var(--wait);
}
.tick.ring {
  background: none;
  border: 3px solid var(--line);
}
.tick.bad {
  background: var(--bad-soft);
  color: var(--bad);
  border: 3px solid var(--bad);
  font: 800 2.75rem/1 var(--f-body);
}
.saved.is-waiting .h1 {
  color: var(--wait);
}

/* Login */
.names {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.names .btn {
  text-align: left;
}

/* Map */
.mapwrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* The map's one-line message keeps the page's side gutter. */
.map-msg {
  padding: 0 16px;
}
.map-msg:not(:empty) {
  padding: 8px 16px;
}
.mapbox {
  position: relative;
  flex: 1;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}
/* Round "Me" button, bottom right in thumb reach, above Google's zoom buttons. */
.mebtn {
  position: absolute;
  right: 10px;
  bottom: 124px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--card);
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}
.me {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1a73e8;
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 6px rgba(26, 115, 232, 0.25);
}
.sheet .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
}
.map {
  flex: 1;
  min-height: 280px;
  background: var(--sunk);
}
.mapbar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}
.toggle {
  pointer-events: auto;
  min-height: 48px;
  padding: 8px 16px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-weight: 700;
  cursor: pointer;
}
.sheet {
  border-top: 1px solid var(--line);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card);
}
.pickmap {
  height: 260px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--sunk);
}
.pin {
  width: 22px;
  height: 22px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--teal);
  border: 3px solid var(--card);
}
.pin.is-done {
  background: var(--done);
}
/* Done pins carry a white tick, so they differ by shape as well as colour. */
.pin.is-done::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 4px;
  height: 8px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(90deg);
}
.pin.is-waiting {
  background: var(--wait);
}
.pin {
  position: relative;
}
.pin.is-picked {
  width: 30px;
  height: 30px;
  background: var(--bad);
}

/* Admin (desktop) */
.admin-head {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 0;
  display: flex;
  align-items: center;
  gap: 16px;
}
.admin-head .h1 {
  flex: 1;
}
/* On the admin page the login button sits in the page, not in a sticky phone bar. */
.admin .foot {
  position: static;
  padding: 0;
  border: 0;
  background: none;
}
.admin {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.admin section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin h2 {
  font-size: 1.25rem;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}
.table th,
.table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table th {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.admin .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.admin .btn {
  min-height: 44px;
  padding: 8px 14px;
}
.msg.good {
  color: var(--good);
}
.board {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
/* Today: four counts. Any that needs Chris is amber and jumps to Needs you. */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
}
.tile .n {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.1;
}
.tile .l {
  font-weight: 600;
  color: var(--muted);
}
.tile.act {
  border-color: var(--wait);
  background: var(--wait-soft);
}
.tile.act .n,
.tile.act .l {
  color: var(--wait);
}
.needs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.need {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 2px solid var(--wait);
  border-radius: var(--radius);
}
/* Saved on this visit: done, so no longer amber. */
.need.done {
  border-color: var(--line);
}
/* At phone width a job row stacks: address, pole and number on top, its buttons wrapping
   underneath, so "Change numbers" is never cut off. */
@media (max-width: 599px) {
  .table.jobs,
  .table.jobs tbody {
    display: block;
  }
  .table.jobs tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  .table.jobs td {
    padding: 0;
    border: 0;
  }
  .table.jobs td:first-child,
  .table.jobs td:last-child {
    flex-basis: 100%;
  }
}
.seg.narrow {
  max-width: 420px;
}
.admin .seg button {
  min-height: 44px;
}
/* Remove sits well apart from Reset PIN, so it's never hit by mistake. */
.btn.danger.apart {
  margin-left: 24px;
}
.admin .actions input {
  min-height: 44px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  max-width: 14em;
}
.table td .msg.bad {
  margin-bottom: 6px;
}
.history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history li {
  background: var(--sunk);
  border-radius: var(--radius);
  padding: 10px 12px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Admin tabs: Today and Desktop */
.admin-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}
.admin-tabs a {
  padding: 10px 16px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 4px solid transparent;
  margin-bottom: -1px;
}
.admin-tabs a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--teal);
}

/* Desktop: wider, glove-free tables */
.desktop {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.desktop > div:empty {
  display: none;
}
.desktop section,
.match-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.desktop h3 {
  font-size: 1.0625rem;
  margin: 0;
}
.group {
  padding: 4px 0;
}
.table .num {
  text-align: right;
  font-family: var(--f-mono);
}
.table input[type="checkbox"] {
  width: 22px;
  height: 22px;
}
.table input:not([type]) {
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.rates input[name="price"] {
  max-width: 9em;
}
.rate-card summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1.25rem;
}
.rate-card[open] summary {
  margin-bottom: 12px;
}
.rates-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}
.flags {
  margin: 0;
  padding-left: 20px;
}
.manual-line {
  align-items: end;
}
.manual-line .btn {
  flex: none;
}
.totals {
  align-self: flex-end;
  text-align: right;
}
.totals p {
  margin: 2px 0;
}
.file-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.file-btn input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.invoice {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
@media (max-width: 699px) {
  .table.lines,
  .table.rates {
    display: block;
    overflow-x: auto;
  }
  .invoice .row {
    flex-direction: column;
  }
}
.manual-lines > .btn {
  align-self: flex-start;
}
.rate-card summary.bad {
  color: var(--bad);
}
.confirm-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding: 12px;
  border: 2px solid var(--bad);
  border-radius: var(--radius);
  background: var(--bad-soft);
}
.confirm-row p {
  flex: 1 1 100%;
  margin: 0;
  font-weight: 700;
}
.confirm-row p:focus {
  outline: none;
}
.desktop label.inline {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.hold-banner {
  margin-bottom: 12px;
  padding: 12px;
  border: 2px solid var(--wait);
  border-radius: var(--radius);
  background: var(--wait-soft);
}
.hold-banner p {
  margin: 0 0 10px;
  font-weight: 700;
}

/* Desktop: the weekly flow, four steps on one page */
.flow-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
}
.flow-bar .step-chips {
  display: flex;
  flex-wrap: wrap;
  flex: 1;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.flow-bar .step-chip {
  padding: 4px 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--muted);
}
.flow-bar .step-chip.open {
  border-color: var(--teal-fill);
  background: var(--teal-soft);
  color: var(--teal-ink);
}
.flow-bar .step-chip.done {
  color: var(--good);
}
/* A link-looking button: at least 44 px tall, underlined, never mistaken for plain text. */
.lk,
.btn.lk {
  min-height: 44px;
  padding: 8px 6px;
  border: 0;
  background: none;
  color: var(--teal-ink);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.desktop .step {
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  gap: 0;
}
.step.open {
  border-color: var(--teal-fill);
}
.step.todo {
  background: var(--sunk);
  color: var(--muted);
}
.step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.step-head h3 {
  font-size: 1.125rem;
}
.step-head .sum {
  flex: 1;
  min-width: 14em;
  color: var(--muted);
}
.stepno {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sunk);
  border: 2px solid var(--line);
  font-weight: 800;
}
.step.open .stepno {
  background: var(--teal-fill);
  border-color: var(--teal-fill);
  color: var(--on-teal);
}
.step.done .stepno {
  background: var(--good-soft);
  border-color: var(--good);
  color: var(--good);
}
.step-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}
.load,
.fix,
.send,
.route,
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.route {
  max-width: 420px;
}
.send > .lk {
  align-self: flex-start;
}
.stack {
  align-items: flex-end;
  gap: 8px;
}
.file-btn:focus-within {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}
.desktop .grp {
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
}
.grp.bad {
  border-color: var(--bad);
  background: var(--bad-soft);
}
.grp.wait {
  border-color: var(--wait);
  background: var(--wait-soft);
}
.grp h4 {
  margin: 0;
  font-size: 1.0625rem;
}
.jr {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr) minmax(0, 1.6fr) auto;
  gap: 8px 14px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.jr .addr {
  font-weight: 700;
}
.jr .n {
  font-size: 0.9375rem;
  color: var(--muted);
}
.acts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.chk {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
}
.chk input {
  width: 26px;
  height: 26px;
}
.inl {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.inl input {
  width: 8em;
  min-height: 44px;
  padding: 6px 10px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.tag.late {
  background: var(--wait-soft);
  color: var(--wait);
}
.tag.nop {
  background: var(--bad-soft);
  color: var(--bad);
}
.tag.ok {
  background: var(--good-soft);
  color: var(--good);
}
.sumline {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--wait-soft);
  color: var(--wait);
  font-weight: 700;
}
.sumline.ok {
  background: var(--good-soft);
  color: var(--good);
}
.readytog {
  display: flex;
  justify-content: space-between;
  width: 100%;
  text-align: left;
}
.blocker {
  padding: 14px;
  border: 3px solid var(--bad);
  border-radius: var(--radius);
  background: var(--bad-soft);
}
.blocker-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--bad);
  font-size: 1.125rem;
}
.blocker .flags {
  margin-top: 8px;
}
.done-box {
  padding: 14px 16px;
  border: 2px solid var(--good);
  border-radius: var(--radius);
  background: var(--good-soft);
}
.done-box .big {
  font-size: 1.25rem;
  font-weight: 800;
}
.drawer {
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.drawer summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  font-size: 1.125rem;
  cursor: pointer;
}
.drawer[open] summary {
  margin-bottom: 12px;
}
@media (max-width: 699px) {
  .jr {
    grid-template-columns: 1fr;
  }
  .acts,
  .stack {
    justify-content: flex-start;
    align-items: flex-start;
  }
}
.fix-filters {
  flex-wrap: wrap;
  gap: 12px;
}
.fix-filters .field {
  flex: 0 1 15rem;
  font-size: 0.9375rem;
}
.fix-filters .field select {
  min-height: 44px;
  padding: 6px 10px;
}
.filter-note {
  padding: 8px 12px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
}
/* While the phone's keyboard is up (src/ui/typing.ts), the bar scrolls with the page and the
   tabs step aside, so neither sits over the box being typed in. Touch screens only. */
@media (pointer: coarse) {
  .typing .foot {
    position: static;
  }
  .typing .tabs {
    display: none;
  }
}
/* The job form's "Leave without saving?" question, inside the sticky bar. Empty: no space. */
.leave-ask:empty {
  display: none;
}
.leave-ask {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 700;
}
