/* Inter (SIL Open Font License, static/fonts/OFL.txt), from our own server so pages never wait on Google's */
@font-face { font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/inter-latin-wght.woff2") format("woff2"); }
/* Jannsen Route: clean, modern light theme. White surfaces on a soft gray page, Inter, thin line icons (Lucide),
   one accent blue for things you can press. Dark sidebar on computers, a white bottom tab bar on phones. Always light. */
:root {
  --bg: #f6f7f9; --card: #ffffff; --ink: #111827; --ink-2: #374151; --muted: #6b7280; --faint: #9ca3af;
  --line: #e5e7eb; --line-2: #f1f2f4;
  --blue: #2563c9; --blue-ink: #ffffff; --blue-hover: #1f55ad; --soft: #eef3fc;
  --red: #b91c1c; --red-soft: #fef2f2; --green: #15803d; --green-soft: #ecfdf3; --amber: #b45309; --amber-soft: #fff7ed;
  --side: #111827; --side-ink: #9ca3af; --side-hover: #1f2937;
  --radius: 12px; --tap: 44px; --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* nothing slid sideways (a swiped checklist row, a dragged stop) may widen the page: that made phones jump and zoom */
html, body { overflow-x: clip; }
/* The phone's status bar / gesture bar heights. In the Android app the reported inset (env) is 0 for the first frame of
   each new page, then corrected, so the page jumped about one status bar (Ryan, 2026-11-11). --sat / --sab are the
   last heights seen, set before the page first draws (base.html), so the first frame already has them. */
:root { --inset-top: max(env(safe-area-inset-top), var(--sat, 0px)); --inset-bottom: max(env(safe-area-inset-bottom), var(--sab, 0px)); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       -webkit-font-smoothing: antialiased; padding-bottom: calc(72px + var(--inset-bottom)); font-feature-settings: "cv11"; }
a { color: var(--blue); text-decoration: none; }
@media (hover: hover) { a:hover { text-decoration: underline; text-underline-offset: 2px; } }   /* not on touch: a tap leaves it stuck */
.btn:hover, nav.bottom a:hover, aside.side a:hover, .kpi:hover, a.r:hover, a.fup:hover, a.chip:hover, .tabs a:hover, .list a:hover { text-decoration: none; }
.ic { flex: none; vertical-align: -3px; }
h1, h2, h3 { letter-spacing: -.01em; }

/* ---------- top bar (white) ---------- */
header.top { position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px);
             border-bottom: 1px solid var(--line); color: var(--ink);
             padding: calc(10px + var(--inset-top)) 16px 10px; display: flex; align-items: center; gap: 10px; min-height: 56px; }
header.top img { width: 28px; height: 28px; border-radius: 50%; }
header.top .back-btn { display:inline-flex; align-items:center; justify-content:center; width:40px; height:40px;
  margin-left:-8px; border-radius:10px; color:var(--ink); flex:none; }
header.top .back-btn:hover { background:var(--soft); }
header.top .home-logo { display:flex; flex:none; border-radius:50%; }
header.top .back-btn + .home-logo { display:none; }
header.top h1 { font-size: 17px; font-weight: 600; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header.top .btn { min-height: 36px; padding: 0 14px; font-size: 14px; }
main { max-width: 760px; margin: 0 auto; padding: 16px; }
main.wide { max-width: 1240px; }

/* ---------- cards, text ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card h2 { font-size: 15px; font-weight: 600; color: var(--ink); margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.late { color: var(--red); font-weight: 600; }
code { background: #f3f4f6; border-radius: 6px; padding: 1px 6px; font-size: 13px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: var(--tap); padding: 0 16px;
       border-radius: 9px; border: 1px solid transparent; background: var(--blue); color: var(--blue-ink); font: inherit; font-weight: 600;
       font-size: 14.5px; text-decoration: none; cursor: pointer; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--blue-hover); }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: #f9fafb; border-color: #d1d5db; }
.btn.danger { background: #fff; color: var(--red); border-color: #fecaca; }
.btn.danger:hover { background: var(--red-soft); }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: default; }
.linkish { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px;
           border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; }
.iconbtn.ghost { border-color: transparent; background: transparent; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- forms ---------- */
label { display: block; font-weight: 500; font-size: 14px; color: var(--ink-2); margin: 12px 0 6px; }
input[type=text], input[type=password], input[type=search], textarea, select, input[type=date], input[type=email], input[type=tel],
input[type=number], input[type=url], input[type=time] {
  width: 100%; min-height: var(--tap); padding: 9px 12px; border-radius: 9px; border: 1px solid #d1d5db; background: #fff;
  color: var(--ink); font: inherit; font-size: 16px; transition: border-color .12s, box-shadow .12s; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 201, .14); }
input[type=search] { padding-left: 36px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 12px center; }
textarea { min-height: 90px; resize: vertical; }
/* Phones and tablets: no corner resize handle (a thumb scrolling down the right edge kept grabbing it).
   Boxes grow with what's typed instead (field-sizing where the browser has it, base.html's script otherwise). */
@media (pointer: coarse) {
  textarea { resize: none; field-sizing: content; max-height: 60vh; overflow-y: auto; }
}
select { appearance: none; padding-right: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; }
/* every dropdown keeps room for its arrow, even when a page sets a tighter padding inline */
select { padding-right: 32px !important; background-position: right 8px center !important; text-overflow: ellipsis; }
input[type=checkbox], input[type=radio] { accent-color: var(--blue); }
.f2 { display: grid; gap: 0 14px; }
@media (min-width: 640px) { .f2 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; margin: 14px 0 0; }
.check input { width: 20px; height: 20px; }

/* ---------- flash messages ---------- */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; margin-bottom: 14px;
         background: var(--green-soft); color: #14532d; border: 1px solid #bbf7d0; font-size: 14.5px; }
.flash .ic { margin-top: 2px; }
.flash .flash-undo { margin: -4px -4px -4px auto; flex: none; }
.flash .flash-undo .btn { background: #fff; color: var(--green); border-color: #bbe5c8; }
.flash.error { background: var(--red-soft); color: #7f1d1d; border-color: #fecaca; }
.flash.redo { background: var(--amber-soft); color: #7c2d12; border-color: #fed7aa; }

/* ---------- tabs: an underlined bar ---------- */
.tabs { display: flex; gap: 4px 20px; margin: 4px 0 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { padding: 9px 0; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14.5px; white-space: nowrap;
          border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--blue); font-weight: 600; }
.card .tabs { margin-top: 0; }

/* ---------- pills / chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: #f3f4f6; color: var(--ink-2);
        font-size: 12.5px; font-weight: 500; text-decoration: none; margin: 2px 4px 2px 0; white-space: nowrap; }
a.chip:hover { background: #e5e7eb; }
a.chip.on { background: var(--blue); color: #fff; }
.chip.warn { background: var(--amber-soft); color: var(--amber); }
.chip.ok, .chip.good { background: var(--green-soft); color: var(--green); }
.chip.bad { background: var(--red-soft); color: var(--red); }

/* ---------- lists and rows ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li a { display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: 58px;
             padding: 10px 4px; border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none; }
.list li:last-child a { border-bottom: 0; }
.fup { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.fup:last-child { border-bottom: 0; }
.fup .btn { white-space: nowrap; }
a.fup:hover { background: #fafbfc; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 16px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 14px; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.plain { list-style: none; margin: 0; padding: 0; }
details.add summary { cursor: pointer; color: var(--blue); font-weight: 600; list-style: none; font-size: 14.5px; }
details.add summary::-webkit-details-marker { display: none; }

/* ---------- tables ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
               padding: 8px; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; font-variant-numeric: tabular-nums; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl a { color: var(--ink); font-weight: 600; text-decoration: none; }

/* ---------- stats ---------- */
.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .n { font-size: 26px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 13.5px; }

/* ---------- activity feed, boards ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.feed li:last-child { border-bottom: 0; }
.feed .meta { font-size: 12.5px; color: var(--muted); }
.feed .note { white-space: pre-wrap; overflow-wrap: anywhere; }
.feed li.change { color: var(--muted); font-size: 13.5px; }
.feed li.pinned { background: var(--amber-soft); border-radius: 10px; padding: 10px 12px; border-bottom: 0; margin-bottom: 6px; }
/* Notes & activity (2026-11-16): one-line calls, filters, month headings, icon actions, faint small changes */
.feed li[hidden] { display: none; }
.feed li.feed-month { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
  padding: 14px 0 4px; border-bottom: 0; }
.feed li.feed-item.change, .feed li.feed-item.followup, .feed li.feed-item.visit { padding: 6px 0; }
.feed-row { display: flex; gap: 8px; align-items: flex-start; }
.feed-main { flex: 1; min-width: 0; }
.feed-main .meta, .feed-small { display: flex; gap: 6px; align-items: center; }
.feed-small { color: var(--muted); font-size: 13px; align-items: flex-start; }
.feed-small svg, .feed-small .icon { flex: none; margin-top: 3px; opacity: .7; }
.feed-acts { display: flex; gap: 2px; flex: none; }
.feed-acts form { margin: 0; }
.icon-btn { background: none; border: 0; padding: 4px; border-radius: 6px; color: var(--muted); cursor: pointer; line-height: 0; }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn.danger:hover { color: var(--red); background: var(--red-soft); }
.call-card { flex: 1; min-width: 0; }
.call-card > summary { list-style: none; cursor: pointer; display: flex; gap: 6px; align-items: flex-start; }
.call-card > summary::-webkit-details-marker { display: none; }
.call-card > summary > svg:first-child { flex: none; margin-top: 3px; color: var(--blue); }
.call-chev { flex: none; margin-top: 3px; color: var(--muted); line-height: 0; }
.call-chev > :last-child, .call-card[open] .call-chev > :first-child { display: none; }
.call-card[open] .call-chev > :last-child { display: inline-block; }
.call-line { flex: 1; min-width: 0; }
.call-reason { display: block; color: var(--ink); font-size: 14px; }
.call-body { margin: 8px 0 2px 21px; padding-left: 10px; border-left: 2px solid var(--line-2); }
.call-body .note { margin: 6px 0; }
.call-kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0; font-size: 13px; }
.call-kv dt { color: var(--muted); } .call-kv dd { margin: 0; }
.feed-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.chip-btn { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 4px 10px;
  font: inherit; font-size: 13px; cursor: pointer; min-height: 30px; }
.chip-btn span { color: var(--muted); margin-left: 2px; }
.chip-btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip-btn.on span { color: rgba(255,255,255,.7); }
.feed-more { margin-top: 6px; }
.board { display: grid; gap: 12px; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); overflow-x: auto; padding-bottom: 8px; }
.col { background: #f3f4f6; border-radius: var(--radius); padding: 10px; min-height: 120px; }
.col h3 { font-size: 13px; margin: 2px 4px 10px; display: flex; justify-content: space-between; color: var(--ink-2); }
.lead-card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
             margin-bottom: 8px; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.lead-card .small { margin-top: 2px; }

/* ---------- phone tab bar ---------- */
nav.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; background: rgba(255,255,255,.96);
             backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding-bottom: var(--inset-bottom); }
nav.bottom a, nav.bottom button { flex: 1; min-height: 62px; display: flex; flex-direction: column; align-items: center;
             justify-content: center; gap: 3px; color: var(--faint); text-decoration: none; font: inherit; font-size: 11.5px; font-weight: 500;
             background: none; border: 0; cursor: pointer; }
nav.bottom a.on { color: var(--blue); font-weight: 600; }
#net { display: none; background: var(--red); color: #fff; text-align: center; padding: 6px; font-size: 14px; }
body.offline #net { display: block; }

/* ---------- layout: dark sidebar on computers ---------- */
.page { min-width: 0; }
aside.side { display: none; }
.only-wide { display: none; }
@media (min-width: 900px) {
  body.signed-in { display: grid; grid-template-columns: 240px 1fr; padding-bottom: 0; font-size: 14.5px; }
  body.signed-in nav.bottom { display: none; }
  body.signed-in header.top .home-logo { display: none; }
  header.top { padding: 0 28px; min-height: 60px; }
  main { padding: 24px 28px; }
  .grid.two { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
  .grid.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .only-wide { display: revert; } .only-narrow { display: none; }
  input[type=text], input[type=password], input[type=search], textarea, select, input[type=date], input[type=email], input[type=tel],
  input[type=number], input[type=url], input[type=time] { font-size: 14.5px; min-height: 40px; }
  .btn { min-height: 40px; font-size: 14px; }

  aside.side { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: var(--side);
               color: var(--side-ink); padding: 14px 12px 10px; overflow-y: auto; }
  aside.side .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; color: #fff;
                      text-decoration: none; padding: 4px 8px 18px; }
  aside.side .brand img { width: 28px; height: 28px; border-radius: 50%; background: #fff; }
  .side-nav { display: flex; flex-direction: column; gap: 1px; }
  .side-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: #6b7280; padding: 16px 10px 5px; }
  aside.side a:not(.brand), aside.side .side-group > summary {
    display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--side-ink);
    text-decoration: none; font-weight: 500; font-size: 14px; cursor: pointer; list-style: none; }
  aside.side .side-group > summary::-webkit-details-marker { display: none; }
  aside.side a:not(.brand):hover, aside.side .side-group > summary:hover { background: var(--side-hover); color: #e5e7eb; }
  aside.side a.on { background: var(--side-hover); color: #fff; box-shadow: inset 2px 0 0 #60a5fa; }
  aside.side .side-group > summary.here { color: #e5e7eb; }
  aside.side .side-group .chev { margin-left: auto; opacity: .6; transition: transform .15s; }
  aside.side .side-group[open] .chev { transform: rotate(180deg); }
  aside.side a.sub { padding: 7px 10px 7px 39px; font-size: 13.5px; font-weight: 400; }
  aside.side a.sub.on { box-shadow: none; color: #fff; }
  .side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 6px 4px; border-top: 1px solid #1f2937; }
  .side-foot .av { width: 30px; height: 30px; border-radius: 50%; background: #334155; color: #fff; display: flex; align-items: center;
                   justify-content: center; font-weight: 600; font-size: 12px; flex: none; }
  .side-foot .who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; font-size: 12.5px; }
  .side-foot .who b { color: #fff; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-foot .iconbtn { color: var(--side-ink); }
  .side-foot .iconbtn:hover { color: #fff; background: var(--side-hover); }
  body.signed-in > #geo-pill, body.signed-in > #outbox-badge, body.signed-in > #net { grid-column: 1 / -1; }
}
@media (max-width: 899px) { .side-foot { display: none; } }
[hidden] { display: none !important; }   /* hidden always wins over a component's display style */

/* meal break warning (base.html): amber 30 minutes before it has to start, red when late */
.meal-bar { display: flex; gap: 10px; align-items: center; padding: 10px 16px; margin: 0;
            background: var(--amber-soft); color: #7c2d12; border-bottom: 1px solid #fed7aa; font-weight: 600; font-size: 14px; }
.meal-bar[hidden] { display: none; }
.meal-bar .mb-text { flex: 1; }
.meal-bar .btn { flex: none; }
.meal-bar.late { background: var(--red-soft); color: #7f1d1d; border-color: #fecaca; }
.meal-bar.on { background: var(--green-soft, #e8f7ee); color: #14532d; border-color: #bbf7d0; font-weight: 500; }
.meal-bar.on .mb-left { font-variant-numeric: tabular-nums; font-size: 15px; }
.meal-bar.on.done { font-weight: 600; }
@media (min-width: 900px) { .meal-bar { padding: 10px 24px; } }

/* cash-plan customers (Ryan, 2026-11-07): light green behind them in the invoice and customer lists */
.cash-row { background: #e4f7d6; }
.cash-row:hover, .cash-row a:hover { background: #d8f2c6; }
.chip.cash-chip { background: #c8ecb0; color: #2d5a12; }
.inv-row.cash-row.picked { background: color-mix(in srgb, var(--blue) 12%, #e4f7d6); }

/* the phone's saved copy of a page (weak signal; sw.js, base.html) */
#copy-bar { background: #fef3c7; color: #92400e; font-size: 13px; font-weight: 600; text-align: center; padding: 4px 12px; }
#copy-bar.ready { background: #dbeafe; color: #1e40af; cursor: pointer; }
.feed-times { color: var(--ink-2); font-weight: 600; }
