/* MS Rollout manager portal. One stylesheet for the whole portal.
   Colours are tokens on :root (light), redefined for dark mode. Base font
   is 17px for reading outdoors; every tap target is at least 44px high. */
:root {
  --accent: #F26B1D;          /* brand orange: fills, icons, borders */
  --accent-ink: #A9440A;      /* orange for text and links on light backgrounds */
  --accent-soft: #FDEBDD;
  --on-accent: #1A1208;       /* text on orange buttons */
  --bg: #F7F5F2;
  --surface: #FFFFFF;
  --surface-2: #F0ECE7;
  --text: #1C1A17;
  --muted: #57514B;
  --border: #D9D3CB;
  --ok: #1B6E36;
  --ok-soft: #E1F2E6;
  --warn: #8A5A00;
  --warn-soft: #FFF1D1;
  --danger: #B3261E;
  --danger-soft: #FCE4E2;
  --info: #1F5FA8;
  --info-soft: #E1ECF8;
  --grey: #5F6368;
  --grey-soft: #ECEDEE;
  --added: #6B3FA0;           /* a shift the worker added (not clocked): Hours, a person's timesheet */
  --added-soft: #EEE6F8;
  --focus: #1F5FA8;
  --chart-1: #D0560F;         /* bars: the brand orange, 3:1 on the surface */
  --shadow: 0 1px 2px rgba(28, 26, 23, .06), 0 4px 16px rgba(28, 26, 23, .06);
  --radius: 12px;
  --gutter: 16px;
  --nav-w: 232px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-ink: #FF9A5C;
    --accent-soft: #3A2414;
    --bg: #141311;
    --surface: #1D1B19;
    --surface-2: #27241F;
    --text: #F2EEE9;
    --muted: #BDB5AC;
    --border: #413C36;
    --ok: #6FD08E;
    --ok-soft: #173322;
    --warn: #F3C35B;
    --warn-soft: #3A2E10;
    --danger: #FF8A80;
    --danger-soft: #3D1A17;
    --info: #8AB8F0;
    --info-soft: #172A40;
    --grey: #B9BCC0;
    --grey-soft: #2C2D2F;
    --added: #C9A8F0;
    --added-soft: #2C2140;
    --focus: #8AB8F0;
    --chart-1: #FF8A4C;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent-ink: #FF9A5C;
  --accent-soft: #3A2414;
  --bg: #141311;
  --surface: #1D1B19;
  --surface-2: #27241F;
  --text: #F2EEE9;
  --muted: #BDB5AC;
  --border: #413C36;
  --ok: #6FD08E;
  --ok-soft: #173322;
  --warn: #F3C35B;
  --warn-soft: #3A2E10;
  --danger: #FF8A80;
  --danger-soft: #3D1A17;
  --info: #8AB8F0;
  --info-soft: #172A40;
  --grey: #B9BCC0;
  --grey-soft: #2C2D2F;
  --added: #C9A8F0;
  --added-soft: #2C2140;
  --focus: #8AB8F0;
  --chart-1: #FF8A4C;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  line-height: 1.45; overflow-x: hidden;
}
a { color: var(--accent-ink); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; line-height: 1.2; }
h2 { font-size: 1.2rem; margin: 1.25rem 0 .5rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
p { margin: .4rem 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.red { color: var(--danger); font-weight: 600; }
.pre { white-space: pre-wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- Buttons and inputs ---- */
button, .btn {
  font: inherit; min-height: 44px; padding: .45rem .95rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; text-decoration: none;
}
button:hover, .btn:hover { border-color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
button.danger { color: var(--danger); border-color: var(--danger); }
button.small, .btn.small { min-height: 36px; padding: .25rem .6rem; font-size: .9rem; }
button:disabled { opacity: .55; cursor: not-allowed; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: .5rem .65rem; min-height: 44px; width: 100%; max-width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); flex: none; }
label.check { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; }

/* ---- Sign-in ---- */
.signin { min-height: 100vh; display: grid; place-items: center; padding: var(--gutter); }
.signin .card { width: 100%; max-width: 420px; }
.signin .brand { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.signin .brand img { width: 44px; height: 44px; }
.signin form { display: grid; gap: .8rem; }
.signin .lang-row { display: flex; justify-content: flex-end; margin-bottom: .2rem; }
.signin .lang-row select { width: auto; min-height: 0; padding: .2rem .4rem; font-size: .9rem; }

/* ---- App shell: left nav on desktop, slide-in menu on phone ---- */
.shell { display: flex; min-height: 100vh; }
.nav {
  width: var(--nav-w); flex: 0 0 var(--nav-w); background: var(--surface); border-right: 1px solid var(--border);
  padding: .75rem .5rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.nav .brand { display: flex; align-items: center; gap: .5rem; padding: .25rem .5rem .75rem; font-weight: 700; }
.nav .brand img { width: 32px; height: 32px; }
/* The company number (every page and the messages window), with its copy button; wraps under the name. */
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.company-no { font-size: .8rem; font-weight: 400; color: var(--muted); display: inline-flex; flex-wrap: wrap; align-items: center; gap: .2rem; }
.company-no button.link { min-height: 0; padding: 0 .2rem; font-size: .8rem; }
.title-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nav a {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 10px;
  color: var(--text); text-decoration: none; min-height: 44px;
}
.nav a .ico { width: 1.4rem; text-align: center; }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav .foot { margin-top: auto; padding: .5rem; display: grid; gap: .4rem; font-size: .9rem; }
.nav .foot a.privacy-link, .signin a.privacy-link { min-height: 0; padding: 0; display: inline; color: var(--muted); text-decoration: underline; }
.main { flex: 1; min-width: 0; padding: var(--gutter) calc(var(--gutter) * 1.5) 3rem; }
.topbar { display: none; }
.syncline { font-size: .85rem; color: var(--muted); display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.syncline.err { color: var(--danger); }
.scrim { display: none; }

@media (max-width: 899px) {
  .shell { display: block; }
  .topbar {
    display: flex; align-items: center; gap: .5rem; position: sticky; top: 0; z-index: 900;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: .4rem var(--gutter);
  }
  .topbar .title { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav {
    position: fixed; z-index: 1000; left: 0; top: 0; bottom: 0; height: 100%;
    transform: translateX(-105%); transition: transform .2s; width: min(300px, 85vw); box-shadow: var(--shadow);
  }
  .nav.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 950; }
  .main { padding: var(--gutter) var(--gutter) 3rem; }
}

/* ---- Page blocks ---- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
/* Hours: buttons and flags in a table cell wrap instead of widening it. */
.btnrow { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.flags { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
.flags .badge { white-space: normal; }
main > .card { margin: 1rem 0; }
.grid { display: grid; gap: 1rem; }
.grid > .card + .card { margin-top: 0; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.tiles { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; text-decoration: none; color: var(--text); display: block; }
a.tile:hover { border-color: var(--accent); }
.tile .num { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.tile .lbl { color: var(--muted); font-size: .92rem; }
.tile .sub { font-size: .88rem; margin-top: .2rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin: .5rem 0 1rem; }
.toolbar > * { flex: 1 1 170px; min-width: 0; }
.toolbar > button, .toolbar > .btn { flex: 0 0 auto; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .6rem 1rem; text-decoration: none; color: var(--text); border-bottom: 3px solid transparent; min-height: 44px; }
.tabs a.active { border-color: var(--accent); font-weight: 600; color: var(--accent-ink); }
.kv { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: .35rem 1rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.form { display: grid; gap: .8rem; }
.form .row { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.field { display: grid; gap: .25rem; min-width: 0; }
.field > .lab { font-weight: 600; font-size: .95rem; display: flex; align-items: center; gap: .3rem; }
.field .help { font-size: .85rem; color: var(--muted); }
.empty { padding: 1.25rem; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: 0; }
.back { display: inline-flex; margin-bottom: .5rem; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .85rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.b-grey { background: var(--grey-soft); color: var(--grey); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-added { background: var(--added-soft); color: var(--added); border-color: var(--added); }

/* ---- Tables: cards on phones ---- */
.tablewrap { width: 100%; overflow-x: auto; } /* a very long word scrolls inside the table, never the page */
table.data { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.data th, table.data td { padding: .55rem .65rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: break-word; }
table.data th { background: var(--surface-2); font-size: .9rem; color: var(--muted); font-weight: 600; cursor: help; }
table.data th.sortable { cursor: pointer; }
table.data th .th-sort { all: unset; cursor: pointer; font: inherit; color: inherit; }
table.data th .th-sort:focus-visible { outline: 2px solid var(--accent, #F26B1D); outline-offset: 2px; border-radius: 3px; }
table.data th[aria-sort="ascending"] .th-sort::after { content: ' ▲'; font-size: .7em; }
table.data th[aria-sort="descending"] .th-sort::after { content: ' ▼'; font-size: .7em; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--surface-2); }
table.data tr.flag td { background: var(--warn-soft); }
/* A shift the worker added, not clocked: its own colour, a bar on the left (the legend under the table). */
table.data tr.worker-added td { background: var(--added-soft); }
table.data tr.worker-added td:first-child { box-shadow: inset 4px 0 0 var(--added); }
table.cal-hours button.cal-day.cal-added { background: var(--added-soft); box-shadow: inset 0 -3px 0 var(--added); }
.legend-added { display: flex; align-items: center; gap: .4rem; color: var(--muted); }
.swatch-added { display: inline-block; width: 1rem; height: 1rem; border-radius: 3px; background: var(--added-soft); border: 2px solid var(--added); flex: none; }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
table.data tfoot td { font-weight: 700; background: var(--surface-2); }
@media (max-width: 700px) {
  table.data, table.data tbody, table.data tfoot, table.data tr, table.data td { display: block; width: 100%; }
  table.data thead { display: none; }
  table.data { border: 0; background: transparent; }
  table.data tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .6rem; padding: .35rem .2rem; }
  table.data td { border: 0; padding: .3rem .6rem; display: grid; grid-template-columns: 40% 1fr; gap: .5rem; }
  table.data td.num { text-align: left; }
  table.data td::before { content: attr(data-label); color: var(--muted); font-size: .88rem; }
  table.data td.nolabel { grid-template-columns: 1fr; }
  table.data td.nolabel::before { content: none; }
}

/* ---- Info (i) icons and their pop-over (title does not show on touch) ---- */
.info {
  display: inline-grid; place-items: center; width: 22px; height: 22px; min-height: 0; padding: 0;
  border-radius: 50%; font-size: .78rem; font-weight: 700; font-style: italic; font-family: Georgia, serif;
  border: 1px solid var(--muted); color: var(--muted); background: transparent; vertical-align: middle; flex: 0 0 auto;
}
.info:hover { border-color: var(--accent); color: var(--accent-ink); }
.pop {
  position: absolute; z-index: 3000; max-width: min(320px, calc(100vw - 32px)); background: var(--text); color: var(--bg);
  padding: .55rem .75rem; border-radius: 10px; font-size: .92rem; box-shadow: var(--shadow); font-style: normal; font-weight: 400;
}

/* ---- Dialogs, toasts ---- */
dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 1.1rem; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog .actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.toasts { pointer-events: none; position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 4000; display: grid; gap: .5rem; width: min(480px, calc(100vw - 32px)); }
.toast { background: var(--text); color: var(--bg); padding: .7rem 1rem; border-radius: 10px; box-shadow: var(--shadow); }
.toast.err { background: var(--danger); color: #fff; }
.alert { padding: .7rem 1rem; border-radius: 10px; margin: .5rem 0; }
.alert.err { background: var(--danger-soft); color: var(--danger); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.code-big { font-size: 2.6rem; font-weight: 800; letter-spacing: .18em; font-family: ui-monospace, Menlo, Consolas, monospace; text-align: center; padding: .6rem; background: var(--accent-soft); border-radius: var(--radius); overflow-wrap: anywhere; user-select: all; }

/* ---- Maps and photos ---- */
.map { height: 420px; width: 100%; border-radius: var(--radius); border: 1px solid var(--border); z-index: 0; }
@media (max-width: 700px) { .map { height: 320px; } }
.pin { background: var(--accent); color: #111; border: 2px solid #fff; border-radius: 50%; width: 30px !important; height: 30px !important; display: grid; place-items: center; font-weight: 800; font-size: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.pin.done { background: #43A047; color: #fff; }
.pin.active { background: #FB8C00; }
.pin.skipped, .pin.delayed { background: #D32F2F; color: #fff; }
.pin.person { background: #1E88E5; color: #fff; border-radius: 8px; width: auto !important; padding: 0 6px; white-space: nowrap; font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .88rem; margin-top: .4rem; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: .3rem; border: 1px solid rgba(0,0,0,.3); }
.photos { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--surface-2); display: block; }
.photos figcaption { font-size: .85rem; color: var(--muted); }
.logo-preview { max-width: 300px; max-height: 140px; background: #fff; padding: .5rem; border: 1px solid var(--border); border-radius: 8px; }
pre.json { background: var(--surface-2); padding: .75rem; border-radius: 8px; overflow: auto; max-height: 260px; font-size: .85rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.runlist .ctl { display: flex; gap: .3rem; flex-wrap: wrap; }

/* ---- Estimates: drawing, prices, the quote ---- */
.est-status { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.map-tall { height: 520px; }
@media (max-width: 700px) { .map-tall { height: 380px; } }
.map.drawing, .map.drawing .leaflet-interactive { cursor: crosshair; }
.draw-bar { align-items: center; }
.draw-bar select { flex: 1 1 220px; }
.draw-state { font-weight: 600; flex: 1 1 200px; }
.draw-help { margin: .4rem 0; }
.vx { background: #fff; border: 2px solid #1C1A17; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.5); cursor: move; }
.vx-plus { background: rgba(255,255,255,.85); color: #1C1A17; border: 1px solid #1C1A17; border-radius: 50%; font: 700 14px/16px system-ui, sans-serif; text-align: center; cursor: copy; }
.leaflet-tooltip.side-len { background: rgba(0,0,0,.72); color: #fff; border: 0; font-weight: 700; font-size: 12px; padding: 1px 6px; box-shadow: none; }
.leaflet-tooltip.side-len::before { display: none; }
.kind-cell { display: inline-flex; align-items: center; gap: .4rem; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.35); flex: 0 0 auto; }
.sel-card { margin: .75rem 0; border-color: var(--accent); }
.subform { padding: .6rem .75rem; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 8px; display: grid; gap: .6rem; }
.subform .row { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
dialog.wide { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.section-head h2 { margin-bottom: .5rem; }
table.sums { width: 100%; border-collapse: collapse; }
table.sums td { padding: .3rem 0; border-bottom: 1px solid var(--border); }
table.sums td:first-child { overflow-wrap: anywhere; hyphens: auto; }
table.sums td.num { text-align: right; white-space: nowrap; padding-left: 1rem; }
table.sums tr.sub td { font-weight: 600; }
table.sums tr.grand td { font-weight: 800; font-size: 1.1rem; border-bottom: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 0 1.2rem; }
/* The estimate's tick list (pages/estimate_items.js): the trade's items as ticks, a ticked item's details below. */
.items .ticks { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: center; margin: .5rem 0; }
.items .tick-item { display: inline-flex; gap: .3rem; align-items: center; }
.items .tick-item.on { font-weight: 600; }
.items .item { border: 1px solid var(--border); border-radius: 8px; padding: .5rem .75rem; margin-top: .75rem; background: var(--surface); }
.items .item-head { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.items .item-head .num { font-weight: 600; white-space: nowrap; }
.items .layers .layer { display: flex; gap: .5rem; align-items: center; margin: .2rem 0; flex-wrap: wrap; }
.items .item-parts tr.off td { color: var(--muted); text-decoration: line-through; }
.items .item-parts input { max-width: 7rem; }
.legacy-items { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; }
.quote-actions .row-actions { margin-top: .4rem; }
.send-number { font-size: 1.05rem; margin: 0; }
.link-box { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; }
/* The quote as it prints: white paper in both themes */
.quote-paper {
  background: #fff; color: #111; border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow);
  padding: clamp(14px, 4vw, 40px); max-width: 860px; font-family: Helvetica, Arial, sans-serif; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere;
}
.quote-paper .q-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.quote-paper .q-head > div { min-width: 0; flex: 1 1 220px; }
.quote-paper .right { text-align: right; }
.quote-paper .q-logo { max-height: 56px; max-width: 220px; display: block; margin-bottom: .3rem; }
.quote-paper .ql { padding: 2px 4px; border-radius: 4px; }
.quote-paper .ql.editable { cursor: pointer; }
.quote-paper .ql.editable:hover, .quote-paper .ql.editable:focus-visible { background: #FDEBDD; }
.quote-paper .q-name, .quote-paper .q-name .qtext { font-size: 20px; font-weight: 700; }
.quote-paper .q-title { font-size: 26px; font-weight: 700; color: #00796B; }
.quote-paper .q-bold, .quote-paper .q-heading, .quote-paper .q-totalBold { font-weight: 700; }
.quote-paper .q-heading { margin-top: .6rem; }
.quote-paper .q-red { font-size: 12px; font-weight: 700; color: #C62828; }
.quote-paper .q-small { font-size: 12.5px; }
.quote-paper .q-tiny { font-size: 11.5px; color: #616161; }
.quote-paper .bullet { display: flex; gap: .45rem; }
.quote-paper .qtext.edited { background: #E1ECF8; }
.quote-paper .qtext.removed { text-decoration: line-through; color: #9AA0A6; }
.quote-paper .q-map img { width: 100%; display: block; margin: .6rem 0; border-radius: 4px; }
.quote-paper .q-price { margin: .8rem 0 .4rem auto; width: min(100%, 340px); }
.quote-paper .q-price hr { border: 0; border-top: 1px solid #999; margin: 4px 0; }
.quote-paper .amount-row { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.quote-paper button.amount { min-height: 0; padding: 0 .3rem; border: 0; border-bottom: 1px dotted #555; border-radius: 0; background: none; color: #111; font: inherit; cursor: pointer; }
.quote-paper button.amount:hover { background: #FDEBDD; }
.quote-paper .q-gap { height: .9rem; }
.quote-paper .row-actions { margin-top: .8rem; }
/* ---- Sites: details, position, drawings ---------------------------------- */
.site-form { margin: 1rem 0; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.addr-find { display: flex; gap: .4rem; }
.addr-find input { flex: 1; min-width: 0; }
.addr-results ul { margin: 0; }
.addr-results li { padding: .2rem 0; }
button.linkish { text-align: left; width: 100%; white-space: normal; overflow-wrap: anywhere; }
.addr-check { color: var(--danger); font-weight: 600; }
.site-pos-map { height: 320px; }
.pos-text { font-variant-numeric: tabular-nums; align-self: center; }
.draw-add { align-items: center; }
.draw-fields { margin-bottom: .75rem; }
.draw-map { height: min(64vh, 640px); cursor: crosshair; }
.draw-map:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.draw-measure { font-weight: 700; font-size: 1.05rem; margin: .25rem 0 .5rem; font-variant-numeric: tabular-nums; }
.draw-hint { margin: .4rem 0; }
.draw-sel { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; min-height: 44px; }
.draw-actions { align-items: center; }
.draw-actions .spacer { flex: 1 1 0; min-width: 0; }
.svx { background: var(--accent); border: 3px solid #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.6); cursor: grab; }
.svx.sel { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent), 0 1px 4px rgba(0,0,0,.6); }
.svx.fixed { border-radius: 3px; background: #1C1A17; color: #fff; font-size: 9px; line-height: 12px; text-align: center; cursor: pointer; }
.svx.fixed.sel { background: #fff; color: #1C1A17; }
.side-lbl { width: 0 !important; height: 0 !important; }
.side-lbl span { position: absolute; left: 0; top: 0; background: rgba(0,0,0,.78); color: #fff; border: 1.5px solid var(--accent); border-radius: 10px; padding: 1px 7px; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; transform: translate(-50%, -50%); }
.side-lbl.sel span { background: #fff; color: #000; }
.crew-list { display: flex; flex-wrap: wrap; gap: 0 1.2rem; max-height: 240px; overflow-y: auto; }
fieldset.radios { border: 1px solid var(--border); border-radius: 10px; padding: .4rem .8rem .6rem; margin: 0; min-width: 0; }
fieldset.radios legend { font-weight: 600; font-size: .95rem; padding: 0 .3rem; }
label.radio { display: flex; gap: .55rem; align-items: flex-start; padding: .35rem 0; }
label.radio input { width: 20px; height: 20px; min-height: 0; margin-top: .1rem; flex: 0 0 auto; accent-color: var(--accent); }
label.radio .help { display: block; font-size: .85rem; color: var(--muted); }
@media (max-width: 700px) {
  .draw-map { height: 58vh; }
  .site-pos-map { height: 260px; }
}

/* ---- Messages: the buttons with their unread count, the banner ---- */
.chat-badge {
  display: inline-block; min-width: 1.5em; padding: .05rem .45rem; border-radius: 999px; text-align: center;
  background: #FFC933; color: #000; font-weight: 700; font-size: .8rem; line-height: 1.4;
}
.nav .chat-open {
  width: 100%; justify-content: flex-start; gap: .6rem; padding: .55rem .7rem; border: 0; border-radius: 10px;
  background: transparent; font-weight: 600; margin-bottom: .25rem;
}
.nav .chat-open .ico { width: 1.4rem; text-align: center; }
.nav .chat-open:hover { background: var(--surface-2); }
.nav .chat-open .chat-badge { margin-left: auto; }
.topbar .chat-open { padding: .35rem .6rem; }
.chat-banner {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .5rem var(--gutter);
  background: #FFC933; color: #000; font-weight: 600;
}
.chat-banner .txt { flex: 1 1 140px; }
.chat-banner button { color: #000; }
.chat-banner button:not(.primary) { background: #fff; border-color: #000; }

/* ---- People ---- */
.company-number { font-size: 1.1rem; margin: 0 0 .75rem; }
.company-number strong { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.3rem; letter-spacing: .06em; }
.card.created { border-color: var(--ok); background: var(--ok-soft); margin-bottom: 1rem; }
.created-line { font-size: 1.25rem; font-weight: 700; overflow-wrap: anywhere; }
.add-person { margin-bottom: 1rem; }
.add-person .field { align-content: start; }
.pwbox { display: flex; gap: .4rem; }
.pwbox input { flex: 1; min-width: 0; }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---- The messages window (messages.html) ---- */
body.chatpage { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.chatpage #root { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap;
  padding: .5rem var(--gutter); background: var(--surface); border-bottom: 1px solid var(--border);
}
.chat-head .brand { display: flex; align-items: center; gap: .5rem; margin-right: auto; }
.chat-head .brand img { width: 30px; height: 30px; }
.chat-head h1 { font-size: 1.25rem; margin: 0; }
.chat-tools { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.chat-tools select { width: auto; min-height: 36px; padding: .2rem .5rem; }
.chat-tools label.check { min-height: 36px; }
.chat-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.chat-side {
  background: var(--surface); border-right: 1px solid var(--border); padding: .6rem; overflow-y: auto;
  display: flex; flex-direction: column; gap: .35rem;
}
.contacts { display: flex; flex-direction: column; gap: .35rem; }
.chip {
  width: 100%; justify-content: flex-start; text-align: left; gap: .5rem; padding: .45rem .6rem; border-radius: 10px;
}
.chip .who { display: grid; min-width: 0; flex: 1; }
.chip .who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .meta { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.active { background: var(--accent-soft); border-color: var(--accent); }
.chip.support { border-color: var(--accent); font-weight: 600; }
.chip.broadcast { margin-top: .4rem; border-style: dashed; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; background: #9AA0A6; }
.chip .dot.on { background: #2E9E4F; }
.chip.unread { animation: chat-blink 1.2s ease-in-out infinite; }
@keyframes chat-blink { 50% { background: #FFF1C2; border-color: #FFC933; color: #1C1A17; } }
@media (prefers-reduced-motion: reduce) { .chip.unread { animation: none; background: #FFF1C2; color: #1C1A17; } }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: .6rem var(--gutter) .6rem; }
.chat-title { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.chat-title h2 { margin: 0; overflow-wrap: anywhere; }
.chat-main > .muted { margin: .1rem 0 .4rem; }
.msg-list {
  flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .45rem;
  padding: .5rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
}
.msgrow { display: flex; }
.msgrow.mine { justify-content: flex-end; }
.bubble { max-width: min(78%, 520px); padding: .45rem .7rem; border-radius: 14px; overflow-wrap: anywhere; }
.bubble.mine { background: #1F6FD1; color: #fff; }
.bubble.theirs { background: #ECEDEF; color: #1C1A17; }
.bubble .body { white-space: pre-wrap; }
.bubble .from { font-size: .78rem; font-weight: 700; opacity: .8; }
.bubble .time { font-size: .72rem; opacity: .75; margin-top: .15rem; text-align: right; }
.bubble .msg-img { display: block; max-width: 100%; width: 260px; max-height: 260px; object-fit: cover; border-radius: 10px; cursor: zoom-in; background: rgba(0,0,0,.08); min-height: 60px; }
.bubble audio { display: block; max-width: 100%; width: 260px; margin-top: .2rem; }
.big-img { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto; border-radius: 8px; }
dialog:has(.big-img) { width: min(1000px, calc(100vw - 32px)); }
.composer { display: flex; gap: .4rem; margin-top: .5rem; }
.composer input[type=text] { flex: 1; min-width: 0; }
.composer .icon { padding: .3rem .55rem; font-size: 1.15rem; }
.rec-row { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; font-weight: 600; }
.rec-dot { color: #D32F2F; animation: chat-blink-dot 1s steps(2) infinite; }
@keyframes chat-blink-dot { 50% { opacity: .2; } }
@media (max-width: 700px) {
  .chat-head { padding: .4rem var(--gutter); }
  .chat-tools { order: 2; width: 100%; }
  .chat-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .chat-side {
    flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--border);
    padding: .45rem var(--gutter); scrollbar-width: thin;
  }
  .contacts { flex-direction: row; }
  .chat-side > * { flex: 0 0 auto; }
  .chip { width: auto; flex: 0 0 auto; max-width: 220px; }
  .chip.broadcast { margin-top: 0; }
  .chat-main { padding: .45rem var(--gutter); }
  .bubble { max-width: 88%; }
  .composer .primary { padding: .45rem .7rem; }
}

/* ---- Printing: only the report ---- */
.print-only { display: none; }
/* ---- Settings tabs and forms ---- */
.subtabs { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: -.25rem 0 1rem; }
.subtabs a { padding: .35rem .85rem; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--text); min-height: 36px; display: inline-flex; align-items: center; }
.subtabs a.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.setcard { margin: 0; display: grid; gap: .8rem; }
.form > .card + .card { margin-top: 0; }
.setcard h2 { margin: 0; }
.unitbox { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.unitbox input, .unitbox select { flex: 1; min-width: 0; }
.unitbox .unit { color: var(--muted); font-size: .9rem; white-space: nowrap; }
input[aria-invalid="true"] { border-color: var(--danger); outline: 2px solid var(--danger); outline-offset: 0; }
.saverow, .actions-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }
table.pricebook input { min-width: 6rem; }
table.pricebook td { vertical-align: middle; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,.35); vertical-align: -1px; }
dialog.wide { width: min(820px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
fieldset.layers { border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .9rem; display: grid; gap: .3rem; min-width: 0; }
fieldset.layers legend { font-weight: 700; padding: 0 .3rem; }
.buildup { display: grid; gap: .6rem; }
.buildup h3 { margin: .6rem 0 0; font-size: 1rem; }
.buildup .row { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.buildup.readonly input, .buildup.readonly select { opacity: .75; }
.daypick { display: flex; gap: .4rem; }
.daypick select:first-child { flex: 2; } .daypick select:last-child { flex: 1; }
.taxrows { display: grid; gap: .4rem; }
.taxrow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) auto; gap: .4rem; align-items: center; }

/* ---- Reports and charts ---- */
.reports { display: grid; gap: 1rem; }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.report-head h2 { margin: 0; }
.report { display: grid; gap: .75rem; min-width: 0; }
.chart { margin: 0; min-width: 0; }
.chart figcaption { font-weight: 600; font-size: .95rem; margin-bottom: .4rem; }
.bars { display: grid; gap: 6px; }
.barrow { display: grid; grid-template-columns: minmax(6rem, 11rem) minmax(0, 1fr) minmax(4.5rem, max-content); gap: .6rem; align-items: center; font-size: .92rem; }
.barrow .blabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barrow .bval { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
svg.bar, svg.stackbar { display: block; overflow: visible; }
svg.bar .track { fill: var(--surface-2); }
svg.bar .fill { fill: var(--chart-1); }
svg.stackbar .part { stroke: var(--surface); stroke-width: 2px; }
.part.ok, .key.ok { fill: var(--ok); background: var(--ok); }
.part.danger, .key.danger { fill: var(--danger); background: var(--danger); }
.part.grey, .key.grey { fill: var(--grey); background: var(--grey); }
.chart-legend { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; font-size: .92rem; }
.chart-legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
@media (max-width: 700px) {
  .barrow { grid-template-columns: minmax(0, 1fr) minmax(4.5rem, max-content); }
  .barrow svg.bar { grid-column: 1 / -1; grid-row: 2; }
  .taxrow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
}
@media (forced-colors: active) {
  svg.bar .fill, .part { fill: CanvasText; }
}

/* ---- Schedule (pages/calendar.js) ---- */
.cal-tools { align-items: flex-end; flex-wrap: wrap; }
.cal-kinds { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; min-height: 44px; }
.cal-wrap { margin-bottom: 1rem; }
table.cal { border-collapse: collapse; width: 100%; table-layout: fixed; background: var(--surface); }
table.cal th, table.cal td { border: 1px solid var(--border); padding: .25rem; vertical-align: top; font-size: .9rem; }
table.cal thead th { background: var(--surface-2); font-weight: 600; text-align: left; }
table.cal-lanes { min-width: 760px; }
table.cal-lanes.cal-oneday { min-width: 0; }
table.cal-lanes th.cal-lane { width: 150px; text-align: left; font-weight: 600; word-break: break-word; }
table.cal-month { min-width: 640px; }
table.cal-month td { height: 96px; }
table.cal td.other { background: var(--surface-2); color: var(--muted); }
table.cal .today { box-shadow: inset 0 0 0 2px var(--accent); }
table.cal td.drop { background: var(--accent-soft); }
.cal-daynum { font-size: .8rem; color: var(--muted); }
/* A person's hours calendar (person.js): hours per day and week, a click opens the day. */
table.cal-hours td { height: 64px; padding: 0; }
table.cal-hours button.cal-day { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; width: 100%; min-height: 64px;
  padding: .25rem .3rem; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
table.cal-hours button.cal-day:hover { background: var(--accent-soft); }
table.cal-hours td.cal-week { background: var(--surface-2); font-weight: 600; text-align: right; vertical-align: middle; padding: .25rem; }
.cal-hrs { font-weight: 700; }
.cal-sub { font-size: .72rem; color: var(--muted); line-height: 1.2; }
@media (max-width: 600px) { table.cal-hours th, table.cal-hours td { font-size: .78rem; } table.cal-hours button.cal-day { padding: .2rem; } }
.cal-item { display: block; width: 100%; min-height: 32px; margin: 0 0 .2rem; padding: .2rem .35rem; text-align: left; font: inherit; font-size: .85rem;
  border-radius: 6px; border: 1px solid var(--border); border-left-width: 4px; background: var(--surface); color: var(--text); cursor: pointer;
  overflow-wrap: anywhere; }
.cal-item[draggable="true"] { cursor: grab; }
.cal-item.cal-job { border-left-color: var(--accent); background: var(--accent-soft); }
.cal-item.cal-req { border-left-color: var(--info); background: var(--info-soft); }
.cal-item.cal-disp { border-left-color: var(--grey); background: var(--grey-soft); }
.cal-item.conflict { border-color: var(--danger); border-left-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.cal-bang { color: var(--danger); font-weight: 700; }
.cal-time { font-weight: 600; }
.cal-lane-tag { color: var(--muted); }
.cal-pool { display: grid; gap: .3rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.num-input { width: 8rem; max-width: 100%; }
.api-key { width: 100%; font-family: ui-monospace, monospace; margin: .3rem 0; }
.api-example { white-space: pre-wrap; word-break: break-all; background: var(--surface-2); padding: .5rem; border-radius: 6px; }

/* Engineering plan (js/engplan.js, js/planview.js): black on white in both themes */
details.engplan { margin: 1rem 0; }
details.engplan > summary { cursor: pointer; font-weight: 700; }
.engplan-box { margin-top: .6rem; min-height: 2rem; }
.engplan-draw { background: #fff; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.engplan-svg { display: block; width: 100%; height: auto; }
.engplan-sub { font-size: 1rem; margin: .8rem 0 .3rem; }
.engplan-short { border-collapse: collapse; font-size: .9rem; }
.engplan-short th, .engplan-short td { border: 1px solid var(--border); padding: .15rem .6rem; text-align: left; }
.engplan-short .num { text-align: right; font-variant-numeric: tabular-nums; }
.engplan-haz { margin: .2rem 0 0; padding-left: 1.5rem; color: var(--danger); }
/* Job sheet (js/pages/jobsheet.js): screen, then A4 / Letter paper */
.js-sheet { max-width: 60rem; }
.js-head { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.js-head h1 { margin: 0; }
.js-sat { display: block; width: 100%; height: auto; border-radius: 6px; }
.js-section { break-inside: avoid; margin-top: .9rem; }
.js-section h2 { font-size: 1.05rem; margin: 0 0 .3rem; }
.js-section ul { list-style: none; margin: 0; padding: 0; }
.js-section li { padding: .15rem 0; display: flex; gap: .5rem; align-items: baseline; }
.js-box { display: inline-block; width: .9rem; height: .9rem; border: 1.5px solid currentColor; border-radius: 2px; flex: none; text-align: center; line-height: .8rem; font-size: .8rem; }
.js-done { color: var(--muted); }
.js-plan-page { break-before: page; }
.photo-add { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .5rem 0; }
@media print {
  @page { margin: 12mm; }
  .js-sheet { max-width: none; }
  .js-sat { max-height: 120mm; object-fit: contain; }
  .engplan-draw { border: 0; }
  .engplan-svg { max-height: 240mm; }
  details.engplan > summary { display: none; }
}

@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --muted: #333; --border: #999; }
  html { font-size: 12pt; }
  .nav, .topbar, .scrim, .no-print, .toasts, .syncline, .chat-banner { display: none !important; }
  .main { padding: 0; }
  .print-only { display: block; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .report-visit { break-inside: avoid; border-top: 1px solid #999; padding: .5rem 0; }
  .photos { grid-template-columns: repeat(4, 1fr); }
  table.data th { cursor: auto; }
}

/* Billing page (js/pages/billing.js) */
.test-mode { margin: 0 0 .8rem; }
.test-mode .badge { font-size: 1rem; padding: .25rem .8rem; }
.billing-total { font-weight: 600; }
.choose-people { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: .5rem 0 1rem; }
.choose-people label { display: inline-flex; align-items: center; gap: .3rem; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .3rem 0; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.billing-banner { display: block; padding: .5rem 1rem; background: var(--warn-soft); color: var(--warn); font-weight: 600; text-decoration: none; }
.billing-banner.err { background: var(--danger-soft); color: var(--danger); }

/* Ops viewing as the manager, notices from MS Rollout, feature request threads */
.view-banner { align-items: center; background: #9b1c1c; color: #fff; display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: center; padding: .5rem 1rem; font-weight: 600; }
.view-banner button { background: #fff; color: #9b1c1c; }
.notice-banner { align-items: center; background: var(--warn-soft); color: var(--text, inherit); display: flex; flex-wrap: wrap; gap: .5rem 1rem; padding: .6rem 1rem; border-bottom: 1px solid var(--line, #ddd); }
.notice-banner > div { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.fr-thread { display: flex; flex-direction: column; gap: .5rem; }
.fr-thread .msg-img { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; margin-top: .3rem; }
.fr-thread .from { font-size: .75rem; font-weight: 700; opacity: .8; }
.fr-thread .time { font-size: .7rem; opacity: .75; text-align: right; margin-top: .2rem; }
.fr-thread .body { white-space: pre-wrap; }
/* Sign-in security: the sum, forgot password, devices, the activity log */
.sum-box { display: flex; align-items: flex-end; gap: .5rem; flex-wrap: wrap; }
.sum-box label { flex: 1; min-width: 12rem; }
.sum-box .sum-answer { max-width: 8rem; }
button.link { background: none; border: 0; color: var(--accent-ink); text-decoration: underline; padding: .3rem .2rem; cursor: pointer; }
.online-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--ok); margin: 0 .35rem; vertical-align: middle; }
.warn-text { color: var(--warn); font-weight: 600; }
.devices-list { max-width: 100%; overflow-x: auto; }
.removed-result ul { margin: .3rem 0 0 1.2rem; padding: 0; }
/* ---- Quote requests: "How it works", the dispatch-an-estimator pick list ---- */
details.howto { margin: .5rem 0 1rem; }
details.howto summary { cursor: pointer; font-weight: 700; }
details.howto ol { margin: .6rem 0 .4rem; padding-left: 1.3rem; }
details.howto li + li { margin-top: .35rem; }
/* Help text holds long addresses (the API's): they wrap on a phone instead of scrolling the page sideways. */
.help-section, details.howto { overflow-wrap: anywhere; }
.crew-list.req-picks { flex-direction: column; flex-wrap: nowrap; }
.crew-list.req-picks label.check { align-items: flex-start; }

/* ---- The company map (js/companymap.js) ---- */
.cmap { margin: .5rem 0 1rem; }
.cmap-tools { display: flex; gap: .5rem; align-items: center; margin: .5rem 0; }
.cmap-search { position: relative; flex: 1 1 auto; min-width: 0; }
.cmap-search input { width: 100%; }
.cmap-suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 1000; margin: 2px 0 0; padding: .25rem 0; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); max-height: 50vh; overflow: auto; }
.cmap-suggest li button { display: block; width: 100%; text-align: left; border: 0; background: none; border-radius: 0; padding: .45rem .7rem; min-height: 40px; font-weight: 400; white-space: normal; overflow-wrap: anywhere; color: var(--text); }
.cmap-suggest li.on button, .cmap-suggest li button:hover { background: var(--accent-soft); }
.cmap-suggest li.none { padding: .45rem .7rem; }
.cmap .k { display: inline-block; color: #fff; font-size: .72rem; font-weight: 700; border-radius: 6px; padding: 1px 6px; margin-right: .4rem; vertical-align: 1px; }
.cmap-menus { display: grid; gap: .4rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); margin: .4rem 0; }
.cmap-menus select { min-width: 0; width: 100%; }
.cmap-layers { margin: .4rem 0 .6rem; padding: .6rem 1rem; }
.cmap-layers summary { cursor: pointer; font-weight: 700; }
.cmap-sets { display: grid; gap: .5rem 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); margin-top: .5rem; align-items: start; }
.cmap-set { border: 1px solid var(--border); border-radius: 10px; padding: .3rem .7rem .5rem; margin: 0; min-width: 0; }
.cmap-set legend { font-weight: 700; font-size: .92rem; padding: 0 .3rem; }
.cmap-set label.check { display: flex; min-height: 36px; overflow-wrap: anywhere; }
.cmap-set .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }
.cmap-card { margin: .6rem 0; border-color: var(--accent); }
.cmap-card-head { display: flex; align-items: center; gap: .4rem; }
.cmap-card-head h3 { margin: 0; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.cmap-card .row-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.cmap-line { margin: .15rem 0; overflow-wrap: anywhere; }
.cmap-stops { margin: .3rem 0; padding-left: 1.4rem; }
.pin.person.estimator { background: #8E24AA; }
.pin.person small { font-weight: 400; opacity: .9; margin-left: 3px; }
.pin.person.stale { background: #9E9E9E; color: #fff; opacity: .85; }
.pin.cust { background: #00897B; color: #fff; width: 26px !important; height: 26px !important; border-radius: 6px; font-size: 14px; }
.pin.req { width: 26px !important; height: 26px !important; font-size: 12px; border-radius: 6px; }
.pin.grey { background: #9E9E9E; color: #fff; }
.pin.sel { outline: 3px solid #FFEB3B; outline-offset: 1px; }
/* People: photo or initial (avatar.js), on the maps with the first name under it. */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 600; line-height: 1;
  flex: 0 0 auto; overflow: hidden; position: relative; vertical-align: middle; user-select: none; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pwho { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.pwho > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.avatar-btn { padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; line-height: 0; flex: 0 0 auto; }
.avatar-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.photo-dialog .photo-big { display: flex; justify-content: center; margin: .5rem 0 1rem; }
.chip.contact .avatar { flex: 0 0 auto; }
.msgrow { align-items: flex-end; gap: 6px; }
.msgrow > .avatar { margin-bottom: 2px; }
.leaflet-marker-icon.leaflet-interactive.pmark, .leaflet-marker-icon.pmark { background: none; border: 0; pointer-events: none; }
.pmark-in { display: flex; flex-direction: column; align-items: center; width: 100%; }
.pmark .avatar, .pmark .nm { pointer-events: auto; cursor: pointer; }
.pmark .avatar { border: 3px solid #1E88E5; box-shadow: 0 0 0 2px #fff, 0 1px 6px rgba(0,0,0,.7); }
.pmark.estimator .avatar { border-color: #8E24AA; }
.pmark.me .avatar { border-color: #E53935; }
.pmark.stale .avatar { border-color: #9E9E9E; filter: grayscale(1); opacity: .8; }
.pmark.sel .avatar { border-color: #FFEB3B; }
.pmark .nm { margin-top: 2px; max-width: 100%; padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.72); color: #fff; font-size: 11px;
  font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 1px #000; }
.pmark .nm small { font-weight: 400; opacity: .85; }
.pmark.stale .nm { color: #ddd; background: rgba(0,0,0,.55); }
.cmap-card-head .avatar { margin-right: 4px; }
.pin.me { background: #E53935; width: 18px !important; height: 18px !important; border: 3px solid #fff; }
.pin.route-storm.todo { background: #0277BD; color: #fff; }
.pin.route-run.todo { background: #8E24AA; color: #fff; }
table.data.priv tr.priv-group td { background: var(--surface-2); }

/* Download everything (Exports) and Delete our company account (Your account) */
.ev-card { margin-bottom: 1rem; }
.ev-what { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }
.ev-parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0 1rem; margin: .25rem 0 .5rem; }
.ev-progress { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.ev-progress progress { width: min(18rem, 100%); height: 1rem; accent-color: var(--accent); }
.ev-list li { display: grid; gap: .35rem; }
.closing-card { border-color: var(--danger); margin-top: 1rem; }

/* Sales pipeline: columns side by side; on phones each column is most of the screen and they scroll sideways */
.pl-filters { align-items: flex-end; flex-wrap: wrap; }
.pl-board { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .75rem; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.pl-col { flex: 1 0 15rem; min-width: 15rem; max-width: 22rem; background: var(--surface-2); border: 2px solid transparent; border-radius: var(--radius); padding: .5rem; scroll-snap-align: start; display: flex; flex-direction: column; }
.pl-col.pl-drop-ok { border-color: var(--ok); background: var(--ok-soft); }
.pl-col.pl-drop-no { border-color: var(--danger); }
.pl-head h2 { font-size: 1.05rem; margin: .25rem 0; }
.pl-sum { display: flex; justify-content: space-between; gap: .5rem; font-size: .95rem; margin-bottom: .5rem; }
.pl-cards { display: flex; flex-direction: column; gap: .5rem; min-height: 4rem; }
.pl-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .55rem .65rem; cursor: pointer; box-shadow: var(--shadow); }
.pl-card[draggable="true"] { cursor: grab; }
.pl-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pl-card.pl-req { border-left: 4px solid var(--warn); }
.pl-card.pl-dragging { opacity: .5; }
.pl-line { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-weight: 600; }
.pl-title { margin: .15rem 0; overflow-wrap: anywhere; }
.pl-value { font-weight: 700; text-align: right; }
.pl-move { margin-top: .35rem; width: 100%; min-height: 36px; }
@media (max-width: 700px) {
  .pl-col { flex: 0 0 85%; max-width: none; }
}
