/* Sales CRM (checkpoint 1, October 22, 2026). The house look of the other staff tools: the company logo in a white
   header, the brand blue (#054fb8), Arial, white cards on a light grey page. Phone-first for the field rep. */
:root {
  --brand: #054fb8;
  --brand-light: #e6eefa;
  --flag: #FFF2CC;
  --ink: #222;
  --muted: #666;
  --line: #d9d9d9;
  --ok: #006100;
  --bad: #C00000;
  --bg: #f5f6f8;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: var(--ink); background: var(--bg); }
[hidden] { display: none !important; }
.top { background: #fff; color: var(--ink); padding: 10px 20px; border-bottom: 3px solid var(--brand); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand .logo { display: block; height: 40px; width: auto; }
.brand .name { border-left: 1px solid var(--line); padding-left: 14px; }
.brand .title { font-size: 18px; font-weight: bold; color: var(--brand); }
.brand .sub { font-size: 12px; color: var(--muted); }
.head-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { color: var(--brand); border: 1px solid transparent; border-radius: 4px; padding: 7px 14px; text-decoration: none; }
.tabs a:hover { background: var(--brand-light); }
.tabs a.on { background: var(--brand); color: #fff; font-weight: bold; }
main { max-width: 1140px; margin: 0 auto; padding: 18px 16px 40px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 16px 18px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
h2 { margin: 0; font-size: 17px; color: var(--brand); }
h3 { margin: 0; font-size: 15px; color: var(--brand); }
.note { color: var(--muted); font-size: 13px; margin: 6px 0 10px; }
.muted { color: var(--muted); }
label { font-size: 12px; font-weight: bold; color: #444; }
input, select, textarea { font: inherit; padding: 7px 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); }
textarea { width: 100%; resize: vertical; }
button { font: inherit; padding: 8px 14px; border-radius: 4px; border: 1px solid var(--brand); cursor: pointer; white-space: nowrap; }
button.primary { background: var(--brand); color: #fff; }
button.secondary { background: #fff; color: var(--brand); }
button.small { background: #fff; color: var(--brand); padding: 3px 10px; font-size: 12px; }
button.remove { background: #fff; color: var(--bad); border-color: var(--bad); padding: 3px 10px; font-size: 12px; }
button.remove.armed { background: var(--bad); color: #fff; }
button:disabled { opacity: .5; cursor: default; }
.bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.saved { color: var(--ok); font-size: 13px; }
.dirty { background: var(--flag); padding: 4px 10px; border-radius: 4px; font-size: 13px; }
.problem { background: #f8d7da; color: var(--bad); border-radius: 4px; padding: 8px 10px; margin-top: 10px; font-size: 13px; }

/* Forms: two columns on a desktop, one on a phone. */
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 10px; }
.pfield { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pfield.full { grid-column: 1 / -1; }
.pfield input, .pfield select, .pfield textarea { width: 100%; }
@media (max-width: 560px) { .pgrid { grid-template-columns: 1fr; } }
dialog.panel { width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; color: var(--ink); }
dialog.panel::backdrop { background: rgba(0, 0, 0, .35); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; }
.panel-foot { margin-top: 14px; }

/* Accounts list: a table on a desktop, stacked cards on a phone. */
.filters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(5, minmax(0, 1fr)); gap: 8px; margin: 10px 0 4px; }
.filters input, .filters select { width: 100%; }
@media (max-width: 760px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .filters .search { grid-column: 1 / -1; } }
/* Tick-box filters (multiPick in ui.js, October 27, 2026): a button that looks like the drop-downs, opening a list. */
.mpick { position: relative; min-width: 0; }
.mpick-btn { width: 100%; text-align: left; font: inherit; padding: 7px 26px 7px 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; position: relative; }
.mpick-btn::after { content: ""; position: absolute; right: 10px; top: 50%; margin-top: -2px; border: 5px solid transparent; border-top-color: #555; border-bottom: 0; }
.mpick-btn.set { border-color: var(--brand); color: var(--brand); font-weight: bold; }
.mpick-panel { position: absolute; z-index: 30; top: calc(100% + 2px); left: 0; min-width: 100%; max-width: calc(100vw - 32px); max-height: 280px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.12); padding: 4px 0; }
.mpick-row { display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-weight: normal; font-size: 14px; white-space: nowrap; cursor: pointer; }
.mpick-row:hover { background: var(--bg); }
.mpick-row input { width: auto; margin: 0; flex: none; }
.mpick-row:first-child { border-bottom: 1px solid var(--line); }
.count { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
/* Pager (October 27, 2026): the range, the per-page picker, Previous and Next; wraps on a phone. */
.pager { display: flex; gap: 8px 10px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 8px 0; }
.pager select { width: auto; font-size: 13px; padding: 4px 6px; }
.pager .pg-range { color: var(--ink); }
.pager button:disabled { opacity: .45; cursor: default; }
.hidden-note { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.hidden-note button { margin-left: 6px; }
table.list { width: 100%; border-collapse: collapse; margin-top: 8px; }
table.list th { text-align: left; font-size: 12px; color: #444; border-bottom: 1px solid var(--line); padding: 6px 8px; }
table.list td { border-bottom: 1px solid var(--line); padding: 9px 8px; vertical-align: top; }
table.list tr.row { cursor: pointer; }
table.list tr.row:hover td { background: var(--brand-light); }
table.list a.name { color: var(--brand); font-weight: bold; text-decoration: none; }
@media (max-width: 760px) {
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr.row { border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; padding: 8px 10px; background: #fff; }
  table.list td { border: 0; padding: 2px 0; }
  table.list td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12px; }
}
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.tier { display: inline-block; min-width: 22px; text-align: center; border-radius: 4px; font-weight: bold; font-size: 12px; padding: 2px 4px; background: #eceff3; color: #555; }
.tier-A { background: #e2efda; color: var(--ok); }
.tier-B { background: var(--brand-light); color: var(--brand); }
.tier-C { background: #eceff3; color: #555; }
.st-meeting, .st-vendor, .st-order { background: #e2efda; color: var(--ok); border-color: #b9d5a6; }
.st-reengage { background: var(--flag); border-color: #e0c060; }
.st-lost { background: #fbe3e5; color: var(--bad); border-color: #e3a0a6; }
/* Touch type colors come from the Lists page (paintChannels in ui.js); grey until they load. */
.ch { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; color: #fff; white-space: nowrap; background: #777; }
.empty { text-align: center; padding: 24px 10px; color: var(--muted); }

/* Account page. */
.facts { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 8px 0; }
.facts .k { color: var(--muted); }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; gap: 0; } .facts .k { margin-top: 8px; font-size: 12px; } }
.contact { border-top: 1px solid var(--line); padding: 12px 0; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.contact .who b { font-size: 15px; }
.contact .lines { margin-top: 4px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.contact a { color: var(--brand); }
.role { font-size: 12px; font-weight: bold; color: var(--brand); text-transform: uppercase; letter-spacing: .03em; }
/* Decision-maker tag (a tick box on the contact, October 27, 2026), on contact cards and the Contacts page. */
.badge.dm { background: var(--brand-light); color: var(--brand); border-color: #b9cdee; text-transform: none; letter-spacing: 0; font-weight: bold; }
.back { display: inline-block; margin-bottom: 10px; color: var(--brand); text-decoration: none; }
.pre { white-space: pre-wrap; }

/* Playbook template. */
.week { border-top: 1px solid var(--line); padding: 10px 0; }
.week h3 { margin-bottom: 6px; }
.step { display: grid; grid-template-columns: 52px 110px 1fr auto; gap: 10px; align-items: start; padding: 8px; border-radius: 4px; }
.step:nth-child(even) { background: var(--bg); }
.step .day { font-weight: bold; }
.step .guidance { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: pre-wrap; }
.step.off { opacity: .55; }
@media (max-width: 640px) { .step { grid-template-columns: 44px 1fr; } .step .ch-cell { grid-column: 2; } .step .what { grid-column: 1 / -1; } .step .acts { grid-column: 1 / -1; } }

.toast { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 30px); opacity: 0; transition: all .2s; background: #1f3b63; color: #fff; padding: 10px 16px; border-radius: 6px; font-size: 14px; z-index: 50; max-width: calc(100vw - 32px); pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); }
.facts a { color: var(--brand); }
/* Shown until the page's data arrives: a cold start can take a few seconds while the database wakes. */
.loading { text-align: center; color: var(--muted); padding: 40px 10px; }

/* Plan and punch card (checkpoint 2): one dot per touch in date order. Filled in its channel color when done, an
   outline when planned, grey with a line through when skipped, a dashed red outline when overdue, a ring when next. */
.punch { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.dot { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; vertical-align: middle; }
.dot.hollow { background: #fff; border-color: #999; }
.dot.skipped { background: #e5e5e5; border-color: #bbb; background-image: linear-gradient(135deg, transparent 45%, #999 45%, #999 55%, transparent 55%); }
.dot.overdue { border-color: var(--bad) !important; border-style: dashed; }
.dot.next { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.legend .dot { width: 12px; height: 12px; margin-right: 4px; }
.legend-types { display: contents; }
.pstep { display: grid; grid-template-columns: 110px 96px 1fr auto; gap: 10px; align-items: start; padding: 8px; border-top: 1px solid var(--line); }
.pstep .when { font-weight: bold; }
.pstep.overdue .when { color: var(--bad); }
.pstep.next { background: var(--brand-light); }
.pstep.done .what, .pstep.done .when { color: var(--muted); }
.pstep.skipped .what b { text-decoration: line-through; color: var(--muted); }
.pstep .state { font-size: 12px; color: var(--muted); }
.pstep details { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: pre-wrap; }
.pstep details summary { cursor: pointer; color: var(--brand); }
.pstep .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) {
  .pstep { grid-template-columns: 1fr auto; }
  .pstep .what { grid-column: 1 / -1; }
  .pstep .acts { grid-column: 1 / -1; justify-content: flex-start; }
}
.label { font-size: 12px; font-weight: bold; color: #444; }
label.choice { font-weight: normal; font-size: 14px; display: flex; gap: 8px; align-items: center; padding: 6px 0; }
label.choice input { width: auto; flex: none; margin: 0; }
.next-box { background: var(--brand-light); border-radius: 6px; padding: 10px; }
.next-box input { max-width: 200px; }
.touch { border-top: 1px solid var(--line); padding: 10px 0; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.touch .head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.touch .meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.next-cell .ch { margin-right: 6px; }
.next-cell.overdue { color: var(--bad); font-weight: bold; }
/* A contact added from the touch dialog. */
.new-contact { background: var(--brand-light); border-radius: 6px; padding: 10px; }
/* Lists page: one row per choice. */
.litem { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.litem .what { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.litem.off .what b { color: var(--muted); }
.litem .acts { display: flex; gap: 6px; flex-wrap: wrap; }
/* An account with no zip can't be placed by the distance search; the marker keeps the gap visible. */
.badge.nozip { background: #fff4e5; border-color: #f0c27b; color: #8a5300; }
/* The header search (October 23, 2026): beside the tabs on a PC, its own row under the logo on a phone. */
.gsearch { position: relative; flex: 1 1 260px; max-width: 440px; }
.gsearch input { width: 100%; }
.gs-panel { position: absolute; top: calc(100% + 4px); left: 0; right: 0; min-width: 300px; max-height: 70vh; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); z-index: 50; padding: 4px 0; }
.gs-head { font-size: 11px; font-weight: bold; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 12px 2px; }
.gs-item { display: block; padding: 7px 12px; color: var(--ink); text-decoration: none; }
.gs-item:hover, .gs-item.on { background: var(--brand-light); }
.gs-main { font-weight: bold; color: var(--brand); }
.gs-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.gs-note { padding: 7px 12px; font-size: 12px; color: var(--muted); }
.gs-note.bad { color: var(--bad); }
@media (max-width: 640px) { .gsearch { order: 3; flex-basis: 100%; max-width: none; } .gs-panel { min-width: 0; } }
/* Contacts page: the filters, the labels showing how a search was read, and the Miles column for distance searches. */
.cfilters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.cfilters .search { grid-column: 1 / -1; }
.cfilters .near, .filters .near { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); }
.cfilters .near #f-miles, .filters .near #f-miles { width: 64px; }
.cfilters .near #f-near, .filters .near #f-near { width: 160px; }
.chips { gap: 6px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--brand-light); color: var(--brand); border-radius: 12px; padding: 3px 4px 3px 10px; font-size: 12px; font-weight: bold; }
.chip-x { background: none; border: 0; color: var(--brand); font-size: 16px; line-height: 1; padding: 0 6px; cursor: pointer; }
table.list th.mi-col, table.list td.mi-col { display: none; }
.has-near table.list th.mi-col, .has-near table.list td.mi-col { display: table-cell; }
#page h3 { margin: 16px 0 6px; }
@media (max-width: 760px) { .cfilters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .has-near table.list td.mi-col { display: block; } }
table.list td a { color: var(--brand); }
@media (max-width: 760px) { table.list td[data-label]:empty { display: none; } }
/* Today and Routes (checkpoint 3, October 23, 2026). */
.small-link { color: var(--brand); font-size: 13px; }
.due-row, .stop { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.due-row .what, .stop .what { min-width: 0; flex: 1; }
.due-row .when { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; margin-bottom: 4px; }
.due-row .late { color: var(--bad); font-weight: bold; }
.due-row a.name, .stop a.name { color: var(--brand); font-weight: bold; text-decoration: none; font-size: 15px; }
.due-row .title { margin-top: 2px; }
.due-row .dm { font-size: 13px; margin-top: 3px; }
.due-row .dm a { color: var(--brand); }
.due-row details { font-size: 12px; color: var(--muted); margin-top: 4px; white-space: pre-wrap; }
.due-row details summary { cursor: pointer; color: var(--brand); }
.due-row .acts, .stop .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.due-row .acts .primary { padding: 8px 22px; }
.stop .next-line { font-size: 13px; margin-top: 3px; }
.stop .next-line .ch { margin-right: 4px; }
.stop .next-line.overdue { color: var(--bad); font-weight: bold; }
.stop .next-line.due { font-weight: bold; }
.daytabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 10px 0 4px; }
.daytabs button { background: #fff; color: var(--brand); padding: 6px 12px; }
.daytabs button.on { background: var(--brand); color: #fff; font-weight: bold; }
h3.city-head { margin: 16px 0 2px; }
.litem .what select { padding: 3px 6px; font-size: 13px; }
@media (max-width: 560px) {
  .due-row, .stop { flex-direction: column; }
  .due-row .acts, .stop .acts { justify-content: flex-start; width: 100%; }
  .due-row .acts a:first-child { flex: 1; }
  .due-row .acts a:first-child .primary { width: 100%; }
}
