.loading {
  text-align: center;
  margin-top: 30vh;
  color: var(--muted);
}
body.readonly .w {
  display: none !important;
}

/* ---------- header and tabs ---------- */
.top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.logo {
  display: flex;
  align-items: center;
}
.logo .logo-mark { height: 24px; }
.company {
  color: var(--muted);
}
.work-status {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-left: auto;
  flex-wrap: wrap;
}
.work-pill {
  font-weight: 700;
  padding: 0.35em 0.8em;
  border-radius: 999px;
  background: var(--soft);
}
.work-pill.on {
  background: color-mix(in srgb, var(--ok) 20%, transparent);
  color: var(--ok);
}
.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  position: sticky;
  top: 57px;
  z-index: 999;
}
.tabs button {
  box-shadow: none;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: none;
  padding: 0.7em 0.9em;
  white-space: nowrap;
  font-weight: 600;
  color: var(--muted);
}
.tabs button.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}
.tabs .badge {
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  padding: 0 0.45em;
  font-size: 0.75rem;
  margin-left: 0.3em;
}
main.page {
  padding: 1rem;
}

/* ---------- live tab ---------- */
/* The map with the trucks panel on its left (big screens; phones put the panel in the list). */
.map-area {
  display: flex;
  gap: 0.75rem;
  min-width: 0;
  min-height: 0;
}
.map-area > .map {
  flex: 1;
  min-width: 0;
}
.truck-slot {
  flex: none;
  width: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.truck-slot.closed {
  width: auto;
}
.truck-slot:empty {
  display: none;
}
.truck-panel-open {
  height: 100%;
  min-height: 120px;
  width: 44px;
  padding: 0.6rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
}
.truck-panel-word {
  writing-mode: vertical-rl;
  letter-spacing: 0.05em;
}
.truck-panel h3,
.truck-panel h4 {
  margin: 0.4rem 0;
}
.tp-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
  align-items: center;
}
/* On phones the panel is part of the list, which scrolls with the page (and its sticky header). */
.side .tp-head {
  position: static;
}
.tp-tip {
  margin: 0 0 0.5rem;
}
.tp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
button.tp-truck {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.truck-panel .chip {
  white-space: normal; /* long "At <location> since <time>" wraps inside the card */
}
/* Crew names a little larger than the card text (owner, 2026-11-19). */
.tp-truck .tp-name {
  font-size: 1.125rem;
}
.tp-head h3 {
  font-size: 1.15rem;
}
button.tp-truck:hover {
  border-color: var(--brand);
}
.tp-truck .badge {
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  padding: 0 0.45em;
  font-size: 0.75rem;
  font-weight: 700;
}
.tp-one {
  margin-bottom: 0.4rem;
}
.tp-one .row:last-child {
  margin-top: 0.5rem;
}
.tp-feed {
  padding-left: 1.1rem;
}
.unread-update {
  color: var(--warn);
  margin-top: 0.3rem;
}
/* While one truck is picked, the others fade on the map. */
.stop-pin.dim,
.truck-label.dim {
  opacity: 0.3;
}
.live {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 1rem;
  height: calc(100vh - 140px);
  min-height: 520px;
}
.live .map {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  min-height: 400px;
}
.live .side {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
@media (max-width: 900px) {
  .live {
    grid-template-columns: 1fr;
    height: auto;
  }
  .live .map {
    height: 55vh;
  }
}
.alert {
  border-left: 5px solid var(--warn);
}
.alert.danger {
  border-left-color: var(--danger);
}
.alert .row {
  margin-top: 0.5rem;
}
.crew-card {
  border-left: 6px solid var(--line);
}
.crew-card .status {
  margin-top: 0.25rem;
}
.progress {
  height: 6px;
  border-radius: 3px;
  background: var(--soft);
  overflow: hidden;
  margin-top: 0.4rem;
}
.progress > div {
  height: 100%;
  background: var(--ok);
}
.feed li {
  margin: 0.35rem 0;
}
.feed {
  padding-left: 1.1rem;
  margin: 0;
}

/* map markers */
.truck-icon {
  background: none;
  border: none;
}
.truck-label {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
}
/* Stops on the Live map: the stop's number on its truck's route, in the truck's colour. */
.stop-icon {
  background: none;
  border: none;
}
.stop-pin {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 3px solid var(--pin);
  background: #fff;
  color: #111;
  font-weight: 800;
  font-size: 11px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
}
.stop-pin.done {
  background: var(--pin);
  color: #fff;
  border-color: #fff;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
}
.stop-pin.here {
  width: 30px;
  height: 30px;
  font-size: 13px;
  border-width: 4px;
}
.stop-pin.once {
  border-style: dashed;
}
.stop-pin.away {
  border-color: #e65100;
  border-width: 4px;
}
/* A check-in outside the location's check-in area (or with no GPS). */
.arrival-far,
.feed li.offsite {
  color: var(--warn);
  font-weight: 600;
}
/* Why a stop wasn't completed (Reports). Long typed reasons wrap. */
.reason {
  color: var(--warn);
  overflow-wrap: anywhere;
}
/* The crew changed this stop's result, service, reason or snow answer after marking it (owner, 2026-11-21). */
.crew-changed {
  color: var(--brand);
  font-weight: 600;
  white-space: nowrap;
}
.stale-flag {
  background: var(--danger);
  color: #fff;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-weight: 700;
}
.map-overlay.open {
  background: var(--panel);
  color: var(--text);
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 260px;
}
/* Closed: just a round red button with the number of trucks. */
.stale-btn {
  width: 2.9rem;
  height: 2.9rem;
  min-height: 0;
  padding: 0;
  border-radius: 999px;
  border: 2px solid #fff;
  background: var(--danger);
  color: #fff;
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  font-weight: 700;
  font-size: 0.95rem;
}
.stale-head {
  gap: 0.4rem;
  align-items: center;
}
.stale-close {
  min-height: 0;
  padding: 0.1rem 0.45rem;
}
.map-overlay ul {
  margin: 0.25rem 0 0;
  padding-left: 1rem;
}

/* ---------- routes board ---------- */
.toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}
.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  align-items: start;
}
.route {
  border-top: 6px solid var(--line);
  padding: 0.75rem;
}
.route.drop-target {
  outline: 3px dashed var(--brand);
}
.route-head {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
/* The route's name gets the whole first line, so it's never cut off (2026-11-19). */
.route-head input {
  width: 100%;
  font-weight: 700;
}
.route-head-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.route-head-row select {
  flex: 1;
  min-width: 0;
}
.stop-list {
  list-style: none;
  margin: 0.6rem 0;
  padding: 0;
  min-height: 40px;
}
.stop-item {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  gap: 0.4rem;
  align-items: center;
  padding: 0.45rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0.35rem 0;
  background: var(--panel);
}
.stop-item[draggable='true'] {
  cursor: grab;
}
.stop-item.dragging {
  opacity: 0.4;
}
.stop-item.decision {
  border-color: var(--warn);
  border-width: 2px;
}
.stop-item .n {
  font-weight: 800;
  color: var(--muted);
  text-align: center;
}
.stop-item .nm {
  font-weight: 600;
}
.stop-item .ad {
  font-size: 0.8rem;
  color: var(--muted);
}
.stop-item .stop-main {
  min-width: 0;
}
.stop-item .stop-top {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
}
.stop-item .stop-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.stop-item .kebab > button {
  min-height: 30px;
  padding: 0.1em 0.5em;
}
.stop-item .ctl {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
}
.stop-item .ctl select {
  flex: 1 1 8rem;
  min-width: 0;
  max-width: 14rem;
}
.stop-item .ctl button,
.stop-item .ctl select {
  min-height: 32px;
  padding: 0.2em 0.45em;
  font-size: 0.85rem;
}
.add-stop {
  display: flex;
  gap: 0.4rem;
}
.add-stop select {
  flex: 1;
  min-width: 0;
}

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  background: var(--panel);
}
th,
td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
tr.edited td:first-child {
  border-left: 4px solid var(--warn);
}
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.two-col > * {
  min-width: 0; /* a wide table scrolls inside its card instead of widening the page */
}
.reports-cols {
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
}
@media (max-width: 900px) {
  .two-col,
  .reports-cols {
    grid-template-columns: minmax(0, 1fr);
  }
}
.loc-map {
  height: 320px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-top: 0.6rem;
}
.results {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0;
}
.results li button {
  width: 100%;
  text-align: left;
  margin: 0.2rem 0;
}
.code-big {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.3em;
}
.member-list {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0;
}
.member-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.2rem 0;
}
.history {
  font-size: 0.85rem;
  padding-left: 1rem;
}
.rec-list {
  list-style: none;
  padding: 0;
}
.rec-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0.4rem 0;
}
.rec-list li.best {
  border: 2px solid var(--ok);
}
.leaflet-container {
  font: inherit;
}

/* ---- Batch 2: passes, one-time stops, kebab menu, settings, photos ---- */
.passes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.3rem;
}
.passes .field-box {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.1rem 0.4rem;
  background: var(--panel);
}
.passes .lbl {
  font-size: 0.75rem;
  color: var(--muted);
}
.passes .num {
  min-width: 1.2em;
  text-align: center;
}
.passes button.tick,
.passes button.lock {
  padding: 0.05rem 0.45rem;
  min-height: 0;
  line-height: 1.3;
}
.passes.met .field-box {
  background: color-mix(in srgb, var(--ok) 15%, var(--panel));
  border-color: var(--ok);
  color: var(--ok);
}
.passes.met .lbl {
  color: inherit;
}
.stop-item.finished {
  opacity: 0.6;
}
.stop-item.one-time {
  border-left: 3px dashed var(--warn);
}
.kebab {
  position: relative;
}
.kebab .menu {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 13rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  padding: 0.25rem;
}
.kebab .menu.hidden {
  display: none;
}
/* Opens rightwards when there's no room on the left (phones), and never wider than the screen. */
.kebab .menu.open-right {
  right: auto;
  left: 0;
}
/* Opens upwards when it would run off the bottom of the screen or of a scrolling table. */
.kebab .menu.open-up {
  top: auto;
  bottom: 100%;
}
.kebab .menu {
  min-width: 15.5rem;
  max-width: calc(100vw - 16px);
}
.kebab .menu button {
  box-shadow: none;
  white-space: normal;
}
.kebab .menu button {
  box-shadow: none;
  text-align: left;
  border: 0;
  background: transparent;
}
.kebab .menu button:hover,
.kebab .menu button:focus-visible {
  background: var(--soft);
}
dialog.modal.wide {
  width: min(46rem, 96vw);
}
.type-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.chip.big {
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.chip button.x {
  box-shadow: none;
  border: 0;
  background: transparent;
  padding: 0 0.2rem;
  min-height: 0;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.6rem;
}
.photo-grid figure {
  margin: 0;
}
.photo-grid img {
  width: 100%;
  height: 10rem;
  object-fit: cover;
  border-radius: 0.4rem;
  border: 1px solid var(--line);
  display: block;
}

/* ---- Batch 3: notifications, locked/unlocked passes, settings spacing ---- */
.alert.warn {
  border-left-color: var(--warn);
}
.alert.info {
  border-left-color: var(--brand);
}
.notif-title {
  margin-top: 0.8rem;
}
button.bell {
  font-weight: 700;
  border-color: var(--warn);
  color: var(--warn);
}
/* Locked: the passes field is greyed out and its − / + can't be pressed. */
.passes.locked .field-box.pass-field {
  border-style: dashed;
}
.passes.locked:not(.met) .field-box.pass-field {
  opacity: 0.45;
  background: var(--soft);
}
.passes.locked .tick {
  display: none; /* locked: the number reads as plain text (2026-11-19) */
}
/* Unlocked: clearly highlighted while you edit. */
.passes.unlocked .field-box.pass-field {
  border: 2px solid var(--brand);
  background: color-mix(in srgb, var(--brand) 12%, var(--panel));
  opacity: 1;
}
.passes button.lock {
  font-size: 0.8rem;
  font-weight: 700;
}
.passes.unlocked button.lock {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
/* Space between the sections of the Routes & Service Settings window. */
dialog.modal.wide .modal-body h3 {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}
dialog.modal.wide .modal-body h3:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* Traffic order suggestion */
.order-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.order-compare h3 { margin: 4px 0; font-size: 0.95rem; }
.order-list { margin: 0; padding-left: 1.6em; }
.order-list li { padding: 2px 0; }
.ok-text { color: var(--ok, #1b7f3b); font-weight: 600; }
.attribution { margin-top: 12px; }
input.num { width: 6em; }
@media (max-width: 560px) { .order-compare { grid-template-columns: 1fr; } }

/* Latest activity: three kinds, each with its own color and tag */
:root { --feed-ack: #6a3fb5; --feed-office: #0b7285; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) { --feed-ack: #b79cf2; --feed-office: #5cc8d8; } }
:root[data-theme='dark'] { --feed-ack: #b79cf2; --feed-office: #5cc8d8; }
.feed li.field { color: var(--text); }
.feed li.ack { color: var(--feed-ack); }
.feed li.office { color: var(--feed-office); }
.feed-tag { display: inline-block; min-width: 3.6em; text-align: center; font-weight: 700; font-size: 0.7em; text-transform: uppercase; letter-spacing: 0.05em; border: 1px solid currentColor; border-radius: 4px; padding: 0 0.3em; vertical-align: 0.1em; }
.feed-time { font-variant-numeric: tabular-nums; }
.feed-by { opacity: 0.8; }
/* No overscroll-behavior: at the top or bottom of the list, scrolling carries on to the column (owner, 2026-11-13). */
.feed-scroll { max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 0.4rem 0.6rem; }
.feed-scroll .feed { list-style: none; padding: 0; }
.feed-scroll .feed li { padding: 0.25rem 0; border-bottom: 1px solid var(--line); margin: 0; }
.feed-scroll .feed li:last-child { border-bottom: 0; }
/* Lines that are new since this person last looked (while the list stays in view). */
.feed-scroll .feed li.new { font-weight: 600; padding-left: 0.7rem; position: relative; }
.feed-scroll .feed li.new::before { content: ''; position: absolute; left: 0; top: 0.75em; width: 0.4rem; height: 0.4rem; border-radius: 999px; background: var(--danger); }
/* Latest activity: four equal tabs sitting on the list (owner, 2026-11-13: tabs, not buttons).
   The open tab is underlined in its kind's colour and joins the box below. */
.feed-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.feed-filter {
  box-shadow: none;
  display: flex; align-items: center; justify-content: center; gap: 0.35em;
  min-height: 40px; padding: 0.3em 0.25em; margin: 0 0 -1px;
  font-size: 0.85rem; font-weight: 600; color: var(--muted);
  background: none; border: none; border-bottom: 3px solid transparent; border-radius: 0;
  white-space: nowrap;
}
.feed-filter:hover { color: var(--text); background: var(--soft); }
.feed-filter .tab-count { font-size: 0.75rem; font-weight: 700; min-width: 1.5em; padding: 0 0.4em; border-radius: 999px; background: var(--soft); color: var(--muted); }
.feed-filter.active { color: var(--brand); border-bottom-color: var(--brand); }
.feed-filter.kind-ack.active { color: var(--feed-ack); border-bottom-color: var(--feed-ack); }
.feed-filter.kind-office.active { color: var(--feed-office); border-bottom-color: var(--feed-office); }
/* The count is only lines not seen yet: a red bubble when there are any, grey at 0. */
.feed-filter .tab-count.unseen { background: var(--danger); color: #fff; }
.activity .feed-scroll { border-top: none; border-radius: 0 0 8px 8px; }
.ack-btn { margin-left: auto; }
.feed-more { text-align: center; border-bottom: 0 !important; }

/* ---------- Prep ---------- */
.work-pill.prep { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand); }
.prep-card { border-left: 4px solid var(--brand); }
.end-summary h3 { margin: 0.9rem 0 0.3rem; font-size: 0.95rem; }
.end-summary h3:first-child { margin-top: 0; }
.end-list { margin: 0; padding-left: 1.2rem; }
.end-list li { margin: 0.2rem 0; }

/* ---------- Dark mode switch ---------- */
.theme-switch { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.25em 0.6em; border-radius: 999px; }
.theme-track { position: relative; width: 2.6em; height: 1.4em; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); flex: none; transition: background 0.15s; }
.theme-knob { position: absolute; top: 50%; left: 0.1em; transform: translateY(-50%); border-radius: 50%; background: var(--panel); box-shadow: 0 1px 2px rgb(0 0 0 / 0.3); font-size: 0.75em; line-height: 1.2em; text-align: center; transition: left 0.15s; display: grid; place-items: center; width: 1.6em; height: 1.6em; }
.theme-switch.on .theme-track { background: var(--brand); border-color: var(--brand); }
.theme-switch.on .theme-knob { left: calc(100% - 1.7em); }
.theme-label { font-size: 0.85rem; }

/* Dark map: the vector map has its own dark style; the picture-tile fallback is inverted to match. */
:root[data-theme='dark'] .raster-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.95) saturate(0.6); }
:root[data-theme='dark'] .leaflet-container { background: #1b1f24; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .raster-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.95) saturate(0.6); }
  :root:not([data-theme='light']) .leaflet-container { background: #1b1f24; }
}
:root[data-theme='dark'] { color-scheme: dark; }
:root[data-theme='light'] { color-scheme: light; }

/* ---- Collapsible route cards ---- */
.route-sub { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.3rem; flex-wrap: wrap; }
.route-toggle { padding: 0.2em 0.7em; font-size: 0.85rem; border-radius: 999px; }
.route.collapsed .stop-list { margin: 0.4rem 0 0; }
.collapsed-note { margin-top: 0.35rem; }

/* ---- Account banners (trial, support visit) and the trial-ended screen ---- */
.account-banner { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; padding: 0.5rem 1rem; font-size: 0.92rem; }
.account-banner.hidden { display: none; }
.account-banner.trial { background: var(--banner-trial-bg); color: var(--banner-trial-text); }
.account-banner.trial.soon { background: var(--banner-soon-bg); color: var(--banner-soon-text); }
.account-banner.support { background: var(--banner-support-bg); color: var(--banner-support-text); }
.account-banner button { flex: none; }
.ended-card p { margin: 0 0 0.75rem; }
:root { --banner-trial-bg: #e7f0fb; --banner-trial-text: #0b2545; --banner-soon-bg: #fff1d6; --banner-soon-text: #5c3b00; --banner-support-bg: #efe6fb; --banner-support-text: #3d1f73; }
:root[data-theme='dark'] { --banner-trial-bg: #16283f; --banner-trial-text: #d6e6fa; --banner-soon-bg: #3d2c08; --banner-soon-text: #ffe2a8; --banner-support-bg: #2b1d45; --banner-support-text: #e3d4ff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) { --banner-trial-bg: #16283f; --banner-trial-text: #d6e6fa; --banner-soon-bg: #3d2c08; --banner-soon-text: #ffe2a8; --banner-support-bg: #2b1d45; --banner-support-text: #e3d4ff; }
}

/* Location import */
.import-steps li {
  margin-bottom: 0.6rem;
}
/* Step 1's two download buttons: look like buttons (no link underline), side by side, wrap on phones. */
.import-downloads {
  gap: 0.5rem;
  flex-wrap: wrap;
}
.import-downloads a.btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.import-panel progress {
  width: 100%;
}
.import-table {
  max-height: 28rem;
  overflow: auto;
}
.import-panel details {
  margin: 0.5rem 0;
}

/* Putting people in trucks */
.crew-card.drop-target {
  outline: 3px dashed var(--brand);
}
.draggable {
  cursor: grab;
}
.notice-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin: 0.5rem 0;
}
.notice-box p {
  margin: 0 0 0.5rem;
}
.person-pick {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 50vh;
  overflow: auto;
}
.person-pick button {
  text-align: left;
}

.import-pick {
  margin-top: 0.4rem;
  align-items: center;
}
.import-file {
  font-weight: 600;
  word-break: break-all;
}

/* Import: review addresses that weren't found, one at a time */
.review-modal {
  width: min(640px, calc(100vw - 32px));
}
.review-map {
  height: 260px;
  border-radius: 8px;
  margin-top: 0.5rem;
}
.review-search input {
  flex: 1;
  min-width: 10rem;
}
.review-ask {
  margin: 0.6rem 0 0.3rem;
  font-weight: 600;
}
.suggest-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.suggest-list button {
  text-align: left;
}
.suggest-list button.selected {
  outline: 3px solid var(--brand);
}

/* Settings: AVA Support contact */
.support-contact {
  display: grid;
  gap: 0.25rem;
  margin: 0.5rem 0 1rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

/* Sign-in: the "Forgot your password?" button, full width under Sign in */
.auth-forgot {
  width: 100%;
  margin-top: 0.5rem;
}

/* ---- Billing (office admins only) ---- */
.billing-section {
  margin-top: 1rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
}
.bill-service {
  margin: 0.6rem 0;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.bill-line {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin: 0.3rem 0;
}
.bill-line input:first-child {
  flex: 1;
  min-width: 8rem;
}
.bill-line input.money {
  width: 6.5rem;
}
.bill-line .dollar {
  font-weight: 700;
}
.fill-ins {
  gap: 0.25rem;
}
.chip-btn {
  min-height: 0;
  padding: 0.1rem 0.45rem;
  font-size: 0.8rem;
  border-radius: 999px;
}
.bill-preview div {
  overflow-wrap: anywhere;
}
.seg {
  display: inline-flex;
  gap: 0;
}
.seg button {
  border-radius: 0;
}
.seg button:first-child {
  border-radius: 8px 0 0 8px;
}
.seg button:last-child {
  border-radius: 0 8px 8px 0;
}
.seg button.warn-on {
  background: #c26a00;
  border-color: #c26a00;
  color: #fff;
}
.bill-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0.5rem 0;
  font-size: 1.1rem;
}
.bill-warn {
  border: 1px solid #e08a00;
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  margin: 0.5rem 0;
}
.bill-customer {
  margin-top: 1rem;
  border-top: 2px solid var(--line);
  padding-top: 0.5rem;
}
.bill-location {
  margin: 0.6rem 0 0.9rem;
}
.billing-review tr.doubled td {
  background: color-mix(in srgb, #e08a00 10%, transparent);
}

/* ---- ⓘ notes, Getting started, Customers list, Prices per pass ---- */
.info-head {
  gap: 0.3rem;
  align-items: center;
}
.info-head h2,
.info-head h3 {
  margin: 0;
}
/* Info bubbles: a solid blue circle with a white "i", easy to spot (owner, 2026-11-13:
   the grey ⓘ was easy to overlook). A ring shows when its note is open. */
.info-btn {
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 24px;
  height: 24px;
  min-height: 0;
  min-width: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--brand);
  color: var(--brand-text);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
  cursor: pointer;
}
.info-btn:hover {
  filter: brightness(1.1);
}
.info-btn[aria-expanded='true'] {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent);
}
.info-note {
  margin: 0.35rem 0 0.5rem;
  padding: 0.45rem 0.6rem;
  border-left: 3px solid var(--brand);
  background: var(--soft);
  border-radius: 4px;
}
.setup-card {
  border: 1px solid var(--brand);
  margin-bottom: 1rem;
}
.setup-card h2 {
  margin: 0;
}
.setup-detail {
  margin-top: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--soft);
  border-radius: var(--radius);
}
.setup-detail p {
  margin: 0.3rem 0 0.6rem;
}
.setup-detail .row button {
  min-height: 44px;
}
.setup-all {
  margin-top: 0.6rem;
}
.setup-all summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.3rem 0;
}
.setup-steps {
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0;
}
.setup-step {
  box-shadow: none;
  display: flex;
  gap: 0.55rem;
  align-items: center;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.4rem 0.2rem;
  min-height: 44px;
  color: inherit;
}
.setup-steps li.done .setup-step {
  color: var(--muted);
}
.setup-steps li.open .setup-step {
  font-weight: 700;
}
.setup-num {
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  border: 2px solid var(--line);
}
.setup-steps li.open .setup-num {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--brand-text);
}
.setup-steps li.done .setup-num {
  border-color: var(--ok);
  color: var(--ok);
}
.share-text {
  white-space: pre-line;
  user-select: all;
}
.cust-list {
  list-style: none;
  margin: 0.5rem 0 0.75rem;
  padding: 0;
}
.cust-list li {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}
.cust-list li .grow {
  min-width: 0;
  overflow-wrap: anywhere;
}
.add-customer input {
  flex: 1;
  min-width: 8rem;
}
.add-customer {
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.add-customer select {
  flex: 1 1 12rem;
}
/* ⚙ Settings → Invoices: three choices, each a large tap target with a short explanation. */
.choice-list {
  display: grid;
  gap: 0.5rem;
}
.choice-list .choice {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin: 0;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: normal;
  cursor: pointer;
}
.choice-list .choice:has(input:checked) {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.choice-list input[type='radio'] {
  min-height: 0;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0.15rem 0 0;
  flex: none;
  accent-color: var(--brand);
}
.choice-list .choice > span {
  display: grid;
  gap: 0.15rem;
}
.invoice-mode .link {
  padding: 0;
}
.wording-form {
  display: grid;
  gap: 0.35rem;
}
.wording-form label {
  font-weight: 600;
  margin-top: 0.4rem;
}
.wording-form .fill-ins {
  flex-wrap: wrap;
}
.chip-token {
  opacity: 0.7;
  font-size: 0.75rem;
}
.wording-list {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.wording-list h3 {
  margin: 0 0 0.25rem;
}
.wording-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}
.wording-row .bill-preview {
  overflow-wrap: anywhere;
}
.storm-split {
  align-items: center;
  margin: 0.4rem 0;
}
.split-customers {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.split-customer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.split-customer select {
  max-width: 100%;
}
.wording-form input {
  width: 100%;
}
.wording-form .bill-preview {
  margin: 0.4rem 0 0.6rem;
}
.snow-depth {
  align-items: center;
  gap: 0.5rem;
  margin: 0.6rem 0;
}
.snow-depth label {
  margin: 0;
}
.deep-snow-card .choice-list,
.checkin-card form {
  margin-bottom: 0.5rem;
}
.checkin-card input[type='range'],
.own-size input[type='range'] {
  width: 100%;
}
.std-size .link {
  padding: 0;
}
.price-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}
.price-svc {
  flex: 1;
  min-width: 4rem;
}
.price-box {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
  margin-left: auto; /* every service's $ box at the same right edge, so they line up */
}
.price-box .itemized-count {
  margin-right: 0.5rem;
  white-space: nowrap;
}
/* Invoice layout: the main line's price, shown on one line (set on the Prices step). */
.loc-dialog .bill-line.main-price {
  align-items: baseline;
  gap: 0.6rem;
}
.loc-dialog .bill-line.main-price > * {
  display: inline;
  flex: none;
}
.price-box input.money {
  width: 6.5rem;
}
.bill-sum {
  font-weight: 700;
}
.icon-btn {
  min-width: 2.4rem;
  padding: 0.2rem 0.5rem;
}
.icon-btn.on {
  border-color: var(--brand);
}
.bill-service .bill-preview {
  margin-top: 0.25rem;
}
.wording {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--line);
}
.wording .row {
  margin-top: 0.35rem;
  gap: 0.5rem;
  align-items: center;
}

.qb-files {
  padding-left: 1.2rem;
}
.qb-files li {
  margin: 0.4rem 0;
}

/* ---- Settings gear (top right) ---- */
button.gear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 0.3rem 0.5rem;
  line-height: 1;
}
button.gear .icon-gear {
  width: 24px;
  height: 24px;
  display: block;
}
button.gear.active {
  border-color: var(--brand);
  border-width: 2px;
  color: var(--brand);
}

/* ---- imports: preview, history, Undo ---- */
.import-mode {
  margin-bottom: 0.6rem;
}
.import-table tr.excluded td {
  opacity: 0.5;
}
.change-list {
  margin: 0.2rem 0 0;
  padding-left: 1rem;
}
.import-history {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
}
.import-history h3 {
  margin: 0 0 0.3rem;
}
.import-history ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.import-history li {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
}
.import-history li .grow {
  min-width: 0;
  overflow-wrap: anywhere;
}
.undo-group {
  margin: 0.5rem 0;
}
.undo-group.remove strong {
  color: var(--danger);
}
.undo-group ul {
  margin: 0.2rem 0 0;
  max-height: 10rem;
  overflow: auto;
}
.qb-customers {
  margin-bottom: 0.6rem;
}
.people-import {
  margin: 0.6rem 0;
}

/* ---- Start window: routes kept from the last prep ---- */
.kept-routes {
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin: 0.5rem 0;
}
.kept-routes p {
  margin: 0 0 0.35rem;
}

/* Removed people (Crews & People tab) */
.removed-people {
  margin-top: 1rem;
}
.removed-people summary {
  cursor: pointer;
  font-weight: 600;
}

/* Location editor: no services yet, add them here */
.services-prompt {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  margin: 0.4rem 0 0.8rem;
}
.services-prompt p { margin: 0 0 0.5rem; }
.add-service input { flex: 1 1 8rem; min-width: 0; }

/* ---------- phones (owner, 2026-11-13) ----------
 * Big screens are unchanged. Under 700 px wide: a one-row header with a single work
 * button, a bottom tab bar with icons, Live as List or Map, and tables as cards. */
.tabs .nav-icon,
.tabs .tab-short,
.work-menu,
.live-toggle,
.phone-only {
  display: none;
}
.live-toggle button[aria-pressed='true'] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-text);
}
@media (max-width: 700px) {
  main.page {
    padding: 0.75rem 0.75rem calc(80px + env(safe-area-inset-bottom));
  }
  .phone-only {
    display: block;
  }

  /* Header: logo, work state, settings. */
  .top {
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
  }
  .top .company,
  .top .work-pill,
  .top .work-status > button:not(.work-menu):not(.gear) {
    display: none;
  }
  .top .work-status {
    flex-wrap: nowrap;
  }
  .work-menu {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    border-radius: 999px;
    font-weight: 700;
    white-space: nowrap;
  }
  .work-menu.on {
    background: color-mix(in srgb, var(--ok) 18%, var(--panel));
    border-color: var(--ok);
    color: var(--ok);
  }
  .work-menu.prep {
    background: color-mix(in srgb, var(--warn) 15%, var(--panel));
    border-color: var(--warn);
    color: var(--warn);
  }

  /* Bottom tab bar. */
  .tabs {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    padding: 0 0 env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    border-bottom: none;
    overflow: visible;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1001;
  }
  .tabs button {
  box-shadow: none;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 60px;
    padding: 6px 2px 8px;
    font-size: 0.72rem;
    border-bottom: none;
    border-top: 3px solid transparent;
  }
  .tabs button.active {
    border-top-color: var(--brand);
    background: color-mix(in srgb, var(--brand) 8%, var(--panel));
  }
  .tabs .nav-icon {
    display: block;
    width: 24px;
    height: 24px;
  }
  .tabs .tab-label {
    display: none;
  }
  .tabs .tab-short {
    display: inline;
  }
  .tabs .badge {
    position: absolute;
    top: 4px;
    left: calc(50% + 8px);
    margin: 0;
  }
  .toast {
    bottom: calc(80px + env(safe-area-inset-bottom));
  }

  /* Live: List or Map. */
  .live-toggle {
    display: flex;
    margin: 0 0 0.75rem;
  }
  .live-toggle button {
    flex: 1;
    min-height: 44px;
  }
  .live {
    display: block;
    height: auto;
    min-height: 0;
  }
  .live[data-mode='list'] .map,
  .live[data-mode='list'] .map-area,
  .live[data-mode='map'] .side,
  .truck-slot {
    display: none;
  }
  .live[data-mode='map'] .map {
    height: calc(100vh - 210px);
    height: calc(100dvh - 210px);
    min-height: 320px;
  }

  /* Tables as cards: People and Locations. */
  .people-table,
  .people-table tbody,
  .loc-table,
  .loc-table tbody {
    display: block;
  }
  .people-table thead,
  .loc-table thead {
    display: none;
  }
  .people-table tr,
  .loc-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
  }
  .people-table td,
  .loc-table td {
    display: block;
    padding: 0;
    border: none;
  }
  .people-table td:first-child,
  .people-table td.w,
  .loc-table .cell-name,
  .loc-table .cell-address,
  .loc-table td.w {
    flex: 1 0 100%;
  }
  .loc-table .cell-address {
    color: var(--muted);
    font-size: 0.9rem;
  }
  .loc-table td[data-label]::before {
    content: attr(data-label) ': ';
    color: var(--muted);
    font-weight: 600;
  }
  .people-table td.w button,
  .loc-table td.w button {
    min-height: 40px;
  }

  .loc-table .price-cell.none.any {
    display: none; /* "Any service: —" says nothing on a phone card */
  }
  .crew-card > .row:first-child input:not([type='color']) {
    flex: 1 1 8rem;
    min-width: 0;
  }

  /* A shorter map in the location editor leaves room to scroll the page with a finger. */
  .loc-map {
    height: 220px;
  }

  /* Routes: the drag hint doesn't apply to touch screens. */
  .toolbar > .muted.small {
    display: none;
  }
}

/* People → Remove: plain button (the confirmation is the red one). */
.remove-person {
  color: var(--danger);
}

/* ---------- scrolling (owner, 2026-11-13) ---------- */
/* Live on big screens: the checklist sits in the column, so map + column fill one screen
   and only the column scrolls. */
.setup-slot:empty {
  display: none;
}
.live .side > .setup-card {
  margin-bottom: 0;
  flex: none;
}
/* Small maps zoom with the wheel only after a click; until then a hint explains. */
.loc-map,
.review-map {
  position: relative;
}
.wheel-hint::after {
  content: 'Click the map to zoom with the mouse wheel';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  pointer-events: none;
}

/* Live on a computer (owner, 2026-11-13): the map is sized to the screen and never
   scrolls; only the right-hand column does. Header, banner and tabs take what they
   need (they can wrap on a narrow monitor); the map and column get the rest. */
@media (min-width: 901px) {
  body.on-live {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  body.on-live #app {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  body.on-live main.page {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  body.on-live .live {
    flex: 1;
    min-height: 0;
    height: auto;
  }
  body.on-live .live .map {
    min-height: 0;
  }
}

/* Map credits behind a small ⓘ (they must stay available: OpenStreetMap licence). */
.credits-compact:not(.credits-open) .leaflet-control-attribution {
  display: none;
}
.leaflet-control.credits-btn {
  width: 26px;
  height: 26px;
  min-height: 0;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  background: rgba(255, 255, 255, 0.85);
  color: #333;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.credits-open .credits-btn {
  background: #fff;
}

/* A line icon in front of a button's words (e.g. the Master routes bookmark). */
button.icon-text {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}
.btn-icon {
  width: 18px;
  height: 18px;
  flex: none;
}

/* Location editor → prices: "If you're trying to create a new service, navigate to Settings." */
.svc-help p {
  margin: 0.2rem 0;
}
.settings-callout .link {
  padding: 0;
  min-height: 0;
  font-size: inherit;
  vertical-align: baseline;
}

/* ⚙ Settings (owner, 2026-11-13: make the cards look uniform). Cards side by side are the
   same height, and every card has the same rhythm inside: heading, short description,
   then its controls, with the same space top and bottom. */
.settings-grid {
  align-items: start;
}
/* Global Settings | My Business Settings (owner, 2026-11-17). */
.settings-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
.settings-col-head {
  margin: 0;
  font-size: 1.15rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--line);
}
.settings-col > .card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0;
}
.settings-col > .card > * {
  margin: 0;
}
.settings-col > .card h2 {
  margin: 0;
}
.settings-col > .card h3 {
  margin: 0.3rem 0 0;
}
.settings-col > .card .code-big {
  margin: 0;
}
.settings-col > .card > ul:empty {
  display: none; /* e.g. no view-only users yet */
}
.settings-col > .card > button,
.settings-col > .card > .btn {
  align-self: flex-start;
}
.photo-form label {
  margin: 0 0 0.25rem;
}
/* The Display card (dark mode switch) is for phones only. */
.settings-col > .card.phone-only {
  display: none;
}
@media (max-width: 700px) {
  .settings-col > .card.phone-only {
    display: flex;
  }
}

/* "No result recorded" pop-up (owner, 2026-11-17). */
.no-result-list {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
  max-height: 55vh;
  overflow-y: auto;
}
.no-result-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
}
.no-result-warn {
  align-items: center;
}

/* Location editor: "Area prices are included in the S1 price" (owner, 2026-11-17). */
.incl-areas {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-weight: 400;
}
.incl-areas span {
  flex: 1;
  min-width: 0;
}
.incl-areas input {
  margin-top: 0.2rem;
}

/* ---- Routes views: Drawers | Cards | List (owner, 2026-11-19) ---- */
.toolbar .toolbar-note {
  flex-basis: 100%;
}
.toolbar .view-label {
  margin-left: auto;
}
.route-views button {
  min-height: 36px;
  padding: 0.25em 0.8em;
}
.passes .pass-sum {
  font-size: 0.9rem;
}
.passes .done-num {
  min-width: 1em;
}
.passes.met .pass-sum {
  color: var(--ok);
}
.kebab .menu button.danger-text {
  color: var(--danger);
}
.route-bar {
  display: inline-block;
  width: 100%;
  max-width: 140px;
  height: 6px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
  vertical-align: middle;
}
.route-bar-fill {
  display: block;
  height: 100%;
  background: var(--brand);
}
.drawers {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.route.drawer {
  border-top: 0;
  border-left: 6px solid var(--line);
  padding: 0;
}
button.drawer-open {
  box-shadow: none;
  display: grid;
  grid-template-columns: 1.2rem minmax(0, 1.3fr) minmax(0, 1fr) minmax(150px, 0.6fr);
  gap: 0.8rem;
  align-items: center;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
}
button.drawer-open:hover {
  background: var(--soft);
}
.drawer-chev {
  color: var(--muted);
}
.drawer-title,
.drawer-next {
  min-width: 0;
  overflow-wrap: anywhere;
}
.drawer-progress {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.drawer-tray {
  border-top: 1px solid var(--line);
  padding: 0.75rem 0.9rem;
}
.drawer-tray .route-head {
  flex-direction: row;
  flex-wrap: wrap;
}
.drawer-tray .route-head input {
  flex: 1 1 14rem;
  width: auto;
}
.drawer-tray .route-head-row {
  flex: 1 1 18rem;
}
.drawer-tray .stop-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0 0.6rem;
}
.drawer-tray .add-stop {
  max-width: 32rem;
}
.route-list td {
  vertical-align: middle;
}
.route-swatch {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 3px;
  margin-right: 0.5rem;
  vertical-align: -1px;
}
.route-list .right {
  text-align: right;
}
.route-details .route {
  border-top-width: 6px;
  box-shadow: none;
  margin: 0;
}
/* The number of service stops reads as plain text until ✎ Edit unlocks it. */
.passes.locked .field-box.pass-field,
.passes.locked:not(.met) .field-box.pass-field {
  border: 0;
  background: transparent;
  opacity: 1;
  padding: 0;
}
.passes.met .field-box.pass-field {
  background: transparent;
  border-color: transparent;
}
.rl-title {
  display: inline-flex;
  align-items: center;
}
.rl-done .route-bar {
  width: 90px;
}
/* Phones: each route is a small stacked block instead of a squeezed table row. */
@media (max-width: 700px) {
  .route-list thead {
    display: none;
  }
  .route-list table,
  .route-list tbody {
    display: block;
  }
  .route-list tr.route-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.15rem 0.6rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--line);
  }
  .route-list tr.route-row td {
    display: block;
    border: 0;
    padding: 0;
    grid-column: 1;
  }
  .route-list tr.route-row td.rl-btn {
    grid-column: 2;
    grid-row: 1 / span 4;
    align-self: center;
  }
  .route-list td.rl-next::before {
    content: 'Next: ';
    color: var(--muted);
  }
}
@media (max-width: 700px) {
  button.drawer-open {
  box-shadow: none;
    grid-template-columns: 1.2rem minmax(0, 1fr);
    gap: 0.3rem 0.6rem;
  }
  .drawer-next,
  .drawer-progress {
    grid-column: 2;
  }
  .toolbar .view-label {
    margin-left: 0;
  }
}

/* ---- Location pop-up with steps (owner, 2026-11-19) ---- */
dialog.loc-dialog {
  width: min(760px, calc(100vw - 32px));
  height: min(760px, calc(100vh - 32px)); /* the same size on every step: it doesn't jump around */
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.25rem;
}
dialog.loc-dialog:not([open]) {
  display: none;
}
.loc-dialog h2 {
  margin: 0 0 0.6rem;
}
.loc-steps {
  list-style: none;
  margin: 0 0 0.8rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 0.4rem;
  border-bottom: 1px solid var(--line);
}
.loc-step-tab {
  box-shadow: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  padding: 0.5rem 0.3rem;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
}
.loc-step-tab.on {
  color: var(--brand);
  border-bottom-color: var(--brand);
}
.loc-step-tab .step-n {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  background: var(--soft);
  color: var(--text);
}
.loc-step-tab.on .step-n {
  background: var(--brand);
  color: #fff;
}
.loc-step-tab .step-label {
  min-width: 0;
}
.loc-panels {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0.1rem 0.2rem 0.5rem;
}
.loc-buttons {
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
  margin-top: 0.4rem;
}
.loc-buttons .grow {
  flex: 1;
}
.loc-buttons button.not-ready {
  opacity: 0.55;
}
/* The red ! next to anything still needed, and on its step. */
.bang {
  display: none;
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
  vertical-align: 1px;
}
.needs > .bang,
.loc-step-tab.needs .bang,
.review-row.needs .bang {
  display: inline-flex;
}
.pin-note:not(.needs) {
  display: none;
}
.pin-note {
  color: var(--danger);
  margin: 0.4rem 0;
}
.loc-dialog .loc-map {
  margin-top: 0.4rem;
}
.loc-dialog .price-row .bang {
  margin-left: 0;
}
.wording-status {
  gap: 0.5rem;
  margin: 0.2rem 0;
}
.loc-dialog .bill-service .bill-preview {
  display: block;
  padding: 0.35rem 0.5rem;
  border-left: 3px solid var(--line);
  background: var(--soft);
  border-radius: 4px;
  color: var(--text);
}
.loc-review h3 {
  margin: 0.4rem 0 0.4rem;
}
.review-row {
  display: grid;
  grid-template-columns: minmax(7rem, 0.4fr) minmax(0, 1fr) auto auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}
.review-label {
  color: var(--muted);
  font-size: 0.9rem;
}
.review-value {
  overflow-wrap: anywhere;
}
.review-row.needs .review-value {
  color: var(--danger);
  font-weight: 600;
}
.review-wording {
  padding: 0.2rem 0 0.4rem;
  overflow-wrap: anywhere;
}
.review-status {
  margin-top: 0.8rem;
  font-weight: 600;
}
.review-status.needs {
  color: var(--danger);
}
.review-status.ok {
  color: var(--ok);
}
@media (max-width: 700px) {
  dialog.loc-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    padding: 0.9rem 16px;
  }
  .loc-step-tab {
  box-shadow: none;
    flex-direction: column;
    gap: 0.2rem;
    text-align: center;
    font-size: 0.75rem;
    padding: 0.35rem 0.1rem;
  }
  .loc-step-tab .bang {
    margin-left: 0;
  }
  .review-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  .review-label {
    grid-column: 1 / -1;
  }
}

.loc-dialog .billing-section {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}
.loc-step-tab:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

/* Split into areas, in the pop-up: the wording gets its own full line, the price and ✕ go
   under it, so the box is never squeezed by a long line beside it (owner, 2026-11-19). */
.loc-dialog .bill-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--line);
}
.loc-dialog .bill-line > input:first-child {
  flex: 1 1 100%;
  min-width: 0;
}
.loc-dialog .bill-line input.money {
  flex: 0 1 8rem;
  width: 8rem;
}

/* ---- Reports: uniform columns (owner, 2026-11-19: "it doesn't matter if it's wrapped or not, but if it's uniform") ----
   Fixed widths: every location's Billing table lines up with the next, and a row's height
   never depends on another row's text. Narrow screens scroll the table sideways instead of
   squeezing it into one-word columns. */
.fixed-table {
  table-layout: fixed;
  width: 100%;
}
.fixed-table td,
.fixed-table th {
  overflow-wrap: anywhere;
}
.bill-table {
  min-width: 760px; /* room for the invoice lines; phones scroll the table sideways */
}
.bill-table col.col-stop {
  width: 9.5rem;
}
.bill-table col.col-service {
  width: 5.5rem;
}
.bill-table col.col-amount {
  width: 8.5rem;
}
.bill-table col.col-rate {
  width: 7.5rem;
}
.bill-table .rate-seg {
  flex-wrap: nowrap;
  white-space: nowrap;
}
.report-table {
  /* One table: its columns already line up. The browser sizes them; the date and the time
     each have their own line, so every row breaks in the same place. */
  table-layout: auto;
  min-width: 900px;
}
.report-table col.col-n {
  width: 2.6rem;
}
/* Break only between words here (a squeezed column must not split "Edit" into letters). */
.report-table td,
.report-table th {
  overflow-wrap: break-word;
}
.report-table td:last-child button {
  white-space: nowrap;
}
.stamp-day,
.stamp-time {
  white-space: nowrap;
}

/* ---- Invoice layout step (owner, 2026-11-19): the invoice on top, two separate actions ---- */
.inv-head {
  gap: 0.5rem;
  margin: 0.3rem 0 0.2rem;
}
/* The invoice preview is a sheet of paper (off-white in both themes, border, shadow, its own
   header) so it can't be mistaken for a setting; what you type in stays as ordinary fields. */
.loc-dialog .bill-service .inv-preview {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 0.85rem 0.35rem;
  background: var(--paper);
  color: var(--paper-ink);
  border: 1px solid var(--paper-line);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  cursor: default;
  user-select: none;
}
.loc-dialog .bill-service .inv-preview:empty {
  display: none;
}
.loc-dialog .inv-preview .inv-sheet-head {
  margin: 0 -0.85rem 0.15rem;
  padding: 0.3rem 0.85rem;
  border-bottom: 1px solid var(--paper-line);
  color: var(--paper-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.loc-dialog .inv-preview .inv-line {
  padding: 0.4rem 0;
  background: none;
  border: 0;
}
.loc-dialog .inv-preview .inv-line + .inv-line {
  border-top: 1px dotted var(--paper-line);
}
.loc-dialog .inv-preview .inv-amount {
  font-variant-numeric: tabular-nums;
}
.inv-line {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
}
.inv-line .inv-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.inv-line .inv-amount {
  flex: none;
  font-weight: 600;
  white-space: nowrap;
}
.inv-line.itemized .inv-text {
  padding-left: 1.2rem;
}
.inv-actions {
  gap: 0.5rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}
.itemized {
  margin-top: 0.6rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--line);
}
.itemized h4 {
  margin: 0.2rem 0 0.3rem;
}
.main-price .small {
  flex: 1 1 100%;
}
.main-text {
  margin-top: 0.5rem;
}
.strong {
  font-weight: 700;
}

/* ---- "Preview invoice" (Review & save, owner 2026-11-19): a plain QuickBooks-style invoice.
   White paper in both themes; company, customer and invoice number are grey boxes. ---- */
/* Review & save: "Preview invoice" centred under its heading, with room around it (owner, 2026-11-19). */
.preview-invoice-row {
  display: flex;
  justify-content: center;
  padding: 0.35rem 0 0.9rem;
}
dialog.modal.qb-preview {
  width: min(56rem, calc(100vw - 2rem));
  max-width: none;
}
.qb-sheet {
  background: #ffffff;
  color: #2b2f33;
  border: 1px solid #d4d7dc;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  padding: 1.5rem 1.75rem 1.75rem;
  font-size: 0.85rem;
}
.qb-grey {
  display: block;
  height: 0.7rem;
  margin: 0.3rem 0;
  max-width: 100%;
  background: #e3e6ea;
  border-radius: 3px;
}
.qb-grey.qb-strong {
  height: 0.9rem;
  background: #cfd4da;
}
.qb-top,
.qb-meta {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.qb-title-box {
  text-align: right;
}
.qb-title {
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  color: #2f6f9f;
  font-weight: 300;
}
.qb-grey.qb-logo {
  height: 2.6rem;
  margin: 0.4rem 0 0 auto;
}
.qb-meta {
  margin-top: 1.25rem;
}
.qb-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #6b7280;
}
.qb-facts {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.35rem 1rem;
  align-items: center;
  align-content: start;
}
.qb-facts .qb-grey {
  margin: 0;
}
.qb-table-wrap {
  margin-top: 1.25rem;
  overflow-x: auto;
}
.qb-table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  background: transparent; /* the paper's white, not the app's dark table colour */
  color: inherit;
}
.qb-table th {
  background: #e8f0f7;
  color: #2f6f9f;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 0.45rem 0.5rem;
}
.qb-table td {
  padding: 0.5rem;
  vertical-align: top;
  border-bottom: 1px dotted #c9ced4;
}
.qb-table .qb-num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.qb-table .qb-date,
.qb-table .qb-item {
  white-space: nowrap;
}
.qb-table .qb-item {
  font-weight: 600;
}
.qb-total {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 1.5rem;
  margin-top: 1rem;
  padding-top: 0.6rem;
  border-top: 1px solid #d4d7dc;
  font-size: 1.1rem;
}
@media (max-width: 600px) {
  .qb-sheet {
    padding: 1rem;
  }
  .qb-title-box {
    text-align: left;
  }
  .qb-grey.qb-logo {
    margin-left: 0;
  }
}

/* ---- Reports → Actions (owner, 2026-11-19): every download, Email and Delete in one pop-up ---- */
.report-head {
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.report-head h2 {
  margin: 0;
}
.actions-btn {
  font-weight: 600;
}
dialog.modal.actions-modal {
  width: min(26rem, calc(100vw - 2rem));
}
.actions-modal .modal-buttons {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}
.actions-modal .modal-buttons button {
  width: 100%;
  text-align: left;
}
.actions-modal .modal-buttons button.danger {
  margin-top: 0.6rem; /* set apart from the downloads */
}
.actions-modal .modal-buttons button.action-cancel {
  text-align: center;
  margin-top: 0.3rem;
}
/* Report view: "+ Add line item" is the page's main button, with a line explaining it. */
.add-line-box {
  margin: 0.9rem 0 0.4rem;
}
.add-line-box .add-line-btn {
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.6em 1.3em;
}
/* The Report's note: one paragraph, single-spaced, green (owner, 2026-11-19). */
.report-note {
  color: var(--ok);
  font-weight: 600;
  line-height: 1.35;
  margin: 0.5rem 0 0.9rem;
}
/* $ Billing: the note at the top in red. */
.please-note {
  color: var(--danger);
  font-weight: 600;
  margin: 0.6rem 0;
}

/* Crews & People: room between "Import people" and the Add person row under it (owner, 2026-11-21). */
.people-head {
  margin-bottom: 0.75rem;
}

/* Invoiced outside QuickBooks (owner, 2026-11-21) */
.outside-qb {display:flex; gap:0.6rem; align-items:flex-start; margin:0.75rem 0; padding:0.6rem 0.75rem; border:1px solid var(--line); border-radius:var(--radius); background:var(--soft); cursor:pointer}
.outside-qb input {margin-top:0.2rem; flex:none}
.outside-qb .outside-note {display:block; font-weight:normal}
.outside-qb.locked {cursor:default}
.outside-qb.locked strong {color:var(--muted)}
.outside-tag {display:inline-block; margin-top:0.25rem}
/* Crew confirmation (owner, 2026-11-23) */
.confirm-tag {display:inline-block; margin-top:0.25rem; background:color-mix(in srgb, var(--ok) 16%, var(--panel)); border:1px solid color-mix(in srgb, var(--ok) 55%, var(--panel)); color:color-mix(in srgb, var(--ok) 80%, #000)}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .confirm-tag {color:var(--ok)} }
:root[data-theme="dark"] .confirm-tag {color:var(--ok)}
.confirm-q {width:100%}
.confirm-chip {display:inline-block; margin-top:0.25rem}
.bill-outside {margin-top:1.5rem; padding-top:1rem; border-top:2px dashed var(--line)}
.outside-dialog {width:min(640px, calc(100vw - 32px))}
.outside-list h3 {margin-top:1rem}
.outside-table {width:100%}

/* Sub-locations (owner, 2026-11-22) */
.sub-of {margin:0 0 0.8rem; padding:0.55rem 0.7rem; border-radius:8px; background:var(--soft)}
.sub-list {list-style:none; margin:0 0 0.8rem; padding:0}
.sub-list li {display:flex; align-items:flex-start; gap:0.5rem; flex-wrap:wrap; padding:0.55rem 0; border-top:1px solid var(--line)}
.sub-list li:last-child {border-bottom:1px solid var(--line)}
.sub-list .grow {min-width:12rem}
.sub-actions {gap:0.4rem; flex-wrap:nowrap}
.sub-count {padding:0; margin-top:0.2rem}
.bill-sub {margin-left:1.25rem; padding-left:0.75rem; border-left:3px solid var(--line)}
.bill-table tr.skipped td {opacity:0.65}
.bill-table tr.skipped td:last-child, .bill-table tr.skipped td:nth-last-child(2) {opacity:1}
.sub-bill {margin-top:0.3rem}
@media (max-width: 640px) { .bill-sub {margin-left:0.4rem; padding-left:0.5rem} }
/* The whole invoice in a sub-location's Preview invoice: its own lines highlighted (owner, 2026-11-22) */
.qb-table tr.qb-mine td {background:var(--soft); font-weight:600}
/* Locations & Customers (owner, 2026-11-23): a pencil menu (Edit, Remove tucked inside),
   a narrower Customers column, and long customer names cut off with "…" and a tooltip. */
.loc-cols {
  grid-template-columns: minmax(0, 2.2fr) minmax(300px, 1fr);
}
@media (max-width: 900px) {
  .loc-cols {
    grid-template-columns: minmax(0, 1fr);
  }
}
.kebab > button.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  min-width: 2.4rem;
  padding: 0.4rem;
}
.kebab .menu .menu-sep {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0.25rem 0;
}
.cust-list li .grow {
  overflow-wrap: normal;
}
.clip {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clip-tip {
  position: fixed;
  z-index: 60;
  max-width: min(28rem, calc(100vw - 16px));
  padding: 0.35rem 0.6rem;
  border-radius: 0.4rem;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  font-weight: 600;
  pointer-events: none;
  overflow-wrap: anywhere;
}
/* The Archive (owner, 2026-11-24): ⚙ Settings → View Archive. */
dialog.modal.archive-dialog {
  width: min(46rem, calc(100vw - 32px));
}
.archive-top {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
  padding-bottom: 0.5rem;
}
.archive-search {
  width: 100%;
}
.archive-count {
  margin: 0.4rem 0 0;
}
.archive-count:empty {
  display: none;
}
.archive-list h3 {
  margin: 1rem 0 0.4rem;
}
.arch-cust {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
}
.arch-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.arch-row .grow {
  min-width: 0;
  overflow-wrap: anywhere;
}
.arch-locs {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0 0 0 1.25rem; /* locations sit under their customer */
}
.arch-locs.lone {
  padding-left: 0;
}
.arch-loc {
  padding: 0.5rem;
  border-top: 1px solid var(--line);
  border-radius: 0.4rem;
}
.arch-addr {
  padding-left: 1.25rem; /* the address sits under the name */
  color: var(--muted);
}
.arch-subs {
  list-style: disc;
  margin: 0.25rem 0 0 2.5rem;
  padding: 0;
}
/* What the search found: highlighted; the rest of its customer stays shown around it. */
.arch-hit {
  background: color-mix(in srgb, var(--warn) 16%, var(--panel));
  outline: 2px solid color-mix(in srgb, var(--warn) 60%, var(--panel));
}
.arch-cust-head.arch-hit {
  border-radius: 0.4rem;
  padding: 0.25rem;
}
.archive-confirm-list {
  max-height: 14rem;
  overflow-y: auto;
  margin: 0.25rem 0 0.75rem;
}
.in-archive {
  margin: 0.25rem 0 0;
  color: var(--warn);
}
@media (max-width: 560px) {
  .arch-row {
    flex-wrap: wrap;
  }
  .arch-locs {
    padding-left: 0.75rem;
  }
}
