/* Driftless CRM. Light, calm, readable in the sun. Brand colours and fonts from the Driftless website (DESIGN.md). */
@font-face { font-family: "Designer"; src: url("../fonts/DESIGNER-1.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --ink: #000;
  --paper: #fff;
  --bg: #f2f4f6;
  --wash: #eceff2;
  --line: #d6dce1;
  --text: #23272b;
  --mute: #5b636b;
  --orange: #f16823;
  --orange-soft: #ffe7d9;
  --green: #1f8a4c; --green-soft: #e1f3e8;
  --blue: #2563a8; --blue-soft: #e3eefa;
  --red: #c0392b; --red-soft: #fbe5e2;
  --yellow: #a86b00; --yellow-soft: #fff3d1;
  --grey-soft: #e9ecef;
  --display: "Designer", "Barlow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, sans-serif;
  --r: 14px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 500 17px/1.45 var(--body); }
a { color: inherit; }
h1, h2, h3 { font-family: var(--body); font-weight: 700; letter-spacing: 0; color: var(--ink); }
.display { font-family: var(--display); font-weight: 400; letter-spacing: .01em; }
h1 { font-size: 26px; line-height: 1.2; margin: 4px 0 8px; }
h2 { font-size: 20px; margin: 24px 0 10px; }
h3 { font-size: 17px; margin: 0 0 6px; }
.money, .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.mute { color: var(--mute); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ---------- frame ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--ink); border-bottom: 3px solid var(--orange);
  display: flex; align-items: center; gap: 12px; padding: 8px 16px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); min-height: 56px; }
.topbar img { height: 34px; width: auto; display: block; }
.topbar .ttl { color: #fff; font-family: var(--display); font-size: 17px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .back { color: #fff; text-decoration: none; font-size: 28px; line-height: 1; padding: 4px 10px 6px 0; }
main { max-width: 860px; margin: 0 auto; padding: 14px 16px calc(var(--tab-h) + 96px + var(--safe-b)); }
.demo-strip { background: var(--yellow-soft); color: #5a4000; font-size: 14px; padding: 6px 16px; text-align: center; }
.demo-strip a { font-weight: 600; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--paper); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: var(--safe-b); height: calc(var(--tab-h) + var(--safe-b)); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none;
  color: var(--mute); font-size: 12px; font-weight: 600; position: relative; }
.tabs a svg { width: 26px; height: 26px; }
.tabs a.on { color: var(--ink); }
.tabs a.on svg { color: var(--orange); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--red); color: #fff; font: 600 12px/1 var(--body); }
.tabs .badge { position: absolute; top: 6px; left: calc(50% + 6px); }

.fab { position: fixed; right: 18px; bottom: calc(var(--tab-h) + 16px + var(--safe-b)); z-index: 45; width: 62px; height: 62px;
  border-radius: 50%; background: var(--orange); border: 2.5px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); }
.fab svg { width: 30px; height: 30px; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 60; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; background: var(--paper); border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + var(--safe-b)); max-width: 560px; margin: 0 auto; box-shadow: 0 -6px 24px rgba(0,0,0,.15); }
.sheet h3 { margin-bottom: 12px; }
.sheet .menu a, .sheet .menu button { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 0 6px;
  border: 0; border-bottom: 1px solid var(--wash); background: none; text-decoration: none; font: 600 18px var(--body); color: var(--text); text-align: left; }
.sheet .menu svg { width: 24px; height: 24px; color: var(--orange); }

/* Wide screens: the same five items become a left sidebar. */
.side { display: none; }
@media (min-width: 900px) {
  .tabs { display: none; }
  .side { display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: 220px; background: var(--ink);
    padding: 18px 12px; gap: 4px; z-index: 30; border-right: 3px solid var(--orange); }
  .side img { width: 150px; margin: 0 auto 18px; display: block; }
  .side a { display: flex; align-items: center; gap: 12px; color: #d9dde1; text-decoration: none; padding: 11px 12px; border-radius: 10px; font-weight: 600; }
  .side a svg { width: 22px; height: 22px; }
  .side a.on, .side a:hover { background: #1d2024; color: #fff; }
  .side a.on svg { color: var(--orange); }
  .side .badge { margin-left: auto; }
  .side .sub { padding-left: 46px; font-weight: 500; font-size: 15px; padding-top: 7px; padding-bottom: 7px; }
  .topbar { margin-left: 220px; }
  .topbar img { display: none; }
  main { margin-left: 220px; max-width: none; padding: 22px 34px 60px; }
  main > .wrap { max-width: 980px; }
  .demo-strip { margin-left: 220px; }
  .fab { bottom: 28px; right: 28px; }
}

/* ---------- pieces ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px; }
.card.tight { padding: 0; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; }
.row > .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 420px) { .grid3:not(.stats) { grid-template-columns: 1fr 1fr; } .stats { gap: 6px; } .stats .stat { padding: 10px; } .stats .stat .v { font-size: 19px; } }

.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font: 600 13px/1.4 var(--body); text-transform: capitalize; white-space: nowrap; }
.tag.grey { background: var(--grey-soft); color: #444b52; }
.tag.blue { background: var(--blue-soft); color: var(--blue); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.orange { background: var(--orange-soft); color: #a8410b; }
.tag.yellow { background: var(--yellow-soft); color: var(--yellow); }
.tag.demo { background: var(--yellow-soft); color: #5a4000; text-transform: none; font-size: 11px; padding: 1px 7px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px;
  border-radius: 12px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); text-decoration: none;
  font: 700 17px/1.15 var(--body); letter-spacing: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; text-align: center; }
.btn.primary { background: var(--orange); box-shadow: 3px 3px 0 var(--ink); }
.btn.primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.quiet { border-color: var(--line); color: var(--text); }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 15px; }
.btn.block { width: 100%; }
.btn svg { width: 20px; height: 20px; }
.next { display: grid; gap: 10px; grid-template-columns: 1fr; margin: 14px 0 18px; }
.next.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 380px) { .next.two { grid-template-columns: 1fr; } }
.linkbtn { background: none; border: 0; padding: 10px 4px; color: var(--mute); text-decoration: underline; font: 500 16px var(--body); cursor: pointer; min-height: 44px; }

/* round icon actions (invoice) */
.icons { display: flex; justify-content: space-between; gap: 6px; margin: 4px 0 16px; }
.icons a, .icons button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0;
  text-decoration: none; color: var(--text); font: 600 12.5px/1.2 var(--body); cursor: pointer; padding: 0; text-align: center; }
.icons .ic { width: 52px; height: 52px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: center; }
.icons .ic svg { width: 22px; height: 22px; color: var(--ink); }
.icons form { flex: 1; display: flex; }

/* record header */
.rec-head .tag { margin-bottom: 6px; }
.rec-head h1 { margin: 2px 0 4px; }
.rec-head .amount { font-family: var(--body); font-weight: 600; }
.addr { display: flex; align-items: center; gap: 10px; color: var(--mute); margin: 4px 0; }
.addr .grow { min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--paper); text-decoration: none; font-weight: 600; font-size: 15px; color: var(--ink); white-space: nowrap; }
.pill svg { width: 18px; height: 18px; color: var(--orange); }

/* lists */
.list { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 12px; }
.list > a, .list > div.li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 60px; text-decoration: none;
  border-bottom: 1px solid var(--wash); color: var(--text); }
.list > a:last-child, .list > div.li:last-child { border-bottom: 0; }
.list > a:active { background: var(--wash); }
.list .t { font-weight: 600; color: var(--ink); }
.list .s { font-size: 14px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .grow { flex: 1; min-width: 0; }
.list .end { text-align: right; flex-shrink: 0; }
.letter { position: sticky; top: 59px; background: var(--bg); font: 700 15px var(--body); padding: 10px 4px 4px; color: var(--mute); z-index: 2; }
.az { position: fixed; right: 2px; top: 130px; bottom: calc(var(--tab-h) + 90px); display: flex; flex-direction: column; justify-content: space-between;
  z-index: 20; font: 600 11px var(--body); }
.az a { text-decoration: none; color: var(--blue); padding: 0 6px; }
@media (min-width: 900px) { .az { display: none; } .letter { top: 59px; } }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips a { flex-shrink: 0; min-height: 40px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--paper); text-decoration: none; font-weight: 600; font-size: 15px; }
.chips a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips .n { margin-left: 6px; color: var(--mute); font-weight: 500; }
.chips a.on .n { color: #cfd5db; }

/* forms */
label { display: block; font-weight: 600; font-size: 15px; margin: 12px 0 5px; color: var(--ink); }
input, select, textarea { width: 100%; min-height: 50px; padding: 10px 12px; font: 500 17px var(--body); color: var(--text);
  background: var(--paper); border: 1.5px solid #c4ccd3; border-radius: 10px; -webkit-appearance: none; appearance: none; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%), linear-gradient(135deg, var(--mute) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 34px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--orange-soft); border-color: var(--orange); }
input[type=checkbox] { width: 26px; height: 26px; min-height: 0; padding: 0; border-radius: 6px; vertical-align: middle; flex-shrink: 0; }
input[type=checkbox]:checked { background: var(--orange); border-color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12l5 5 9-10' fill='none' stroke='black' stroke-width='3'/%3E%3C/svg%3E"); }
.check { display: flex; align-items: center; gap: 12px; font-weight: 600; min-height: 48px; margin: 6px 0; }
.search { position: relative; }
.search input { padding-left: 44px; border-radius: 12px; }
.search svg { position: absolute; left: 14px; top: 15px; width: 20px; height: 20px; color: var(--mute); }
.formbar { position: sticky; bottom: calc(var(--tab-h) + var(--safe-b)); background: linear-gradient(to top, var(--bg) 75%, transparent);
  padding: 16px 0 10px; display: grid; gap: 10px; z-index: 5; }
@media (min-width: 900px) { .formbar { bottom: 0; } }

/* flash */
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 12px; font-weight: 600; }
.flash.good { background: var(--green-soft); color: #145c33; }
.flash.bad { background: var(--red-soft); color: #8a2318; }

/* home */
.hello { margin: 0 0 12px; }
.hello .mute { font-size: 15px; }
.job { border-left: 5px solid var(--blue); }
.job.done { border-left-color: var(--green); opacity: .8; }
.job .time { font: 700 18px var(--body); color: var(--ink); }
.att { border-left: 5px solid var(--line); padding: 0; overflow: hidden; }
.att.red { border-left-color: var(--red); } .att.orange { border-left-color: var(--orange); }
.att.yellow { border-left-color: #e0a500; } .att.green { border-left-color: var(--green); } .att.blue { border-left-color: var(--blue); }
.att-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px 6px; }
.att-h h3 { margin: 0; flex: 1; font-size: 16px; }
.att-hint { padding: 0 16px 6px; font-size: 14px; color: var(--mute); }
.att-c { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--wash); }
.att-c .grow { flex: 1; min-width: 0; }
.att-c .grow a { text-decoration: none; }
.att-c form { margin: 0; }
.hide-x { background: none; border: 0; color: var(--mute); font: 600 13px var(--body); padding: 8px 4px; min-height: 44px; cursor: pointer; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.stat .k { font-size: 13px; color: var(--mute); font-weight: 600; }
.stat .v { font-size: 22px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.chg { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 999px; margin-left: 4px; vertical-align: middle; }
.chg.up { background: var(--green-soft); color: var(--green); } .chg.down { background: var(--red-soft); color: var(--red); }
.allclear { text-align: center; padding: 22px; color: var(--green); font-weight: 600; }

/* line items */
.items { width: 100%; border-collapse: collapse; }
.items td { padding: 10px 0; border-bottom: 1px solid var(--wash); vertical-align: top; }
.items td.amt { text-align: right; white-space: nowrap; font-weight: 600; padding-left: 10px; }
.items tr.opt td { color: var(--mute); }
.totals { margin-top: 8px; }
.totals .row { justify-content: space-between; padding: 4px 0; }
.totals .grand { font-size: 21px; font-weight: 600; color: var(--ink); border-top: 2px solid var(--ink); padding-top: 8px; margin-top: 6px; }

.editor .it { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.editor .it .top { display: flex; gap: 8px; align-items: center; }
.editor .it .top input { font-weight: 600; }
.editor .it .qp { display: grid; grid-template-columns: 80px 1fr auto; gap: 8px; align-items: end; margin-top: 8px; }
.editor .it .qp label { margin: 0 0 3px; font-size: 13px; }
.editor .it .lt { font-weight: 600; padding-bottom: 13px; min-width: 80px; text-align: right; }
.editor .x { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--mute); width: 44px; height: 44px; cursor: pointer; flex-shrink: 0; }
.picker { max-height: 46vh; overflow-y: auto; }
.picker button { display: flex; width: 100%; justify-content: space-between; align-items: center; min-height: 54px; padding: 0 6px; border: 0;
  border-bottom: 1px solid var(--wash); background: none; font: 600 17px var(--body); color: var(--text); cursor: pointer; text-align: left; }

/* tabs inside a page */
.ptabs { display: flex; border-bottom: 2px solid var(--line); margin: 16px 0 12px; }
.ptabs button { flex: 1; background: none; border: 0; min-height: 48px; font: 700 16px var(--body); color: var(--mute); cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px; }
.ptabs button.on { color: var(--ink); border-bottom-color: var(--orange); }

/* calendar */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-head h2 { margin: 0; flex: 1; font-size: 18px; text-align: center; }
.cal-head a.arrow { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--line);
  background: var(--paper); border-radius: 12px; text-decoration: none; font-size: 22px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--wash); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.seg a { text-align: center; min-height: 42px; display: flex; align-items: center; justify-content: center; border-radius: 9px; text-decoration: none;
  font-weight: 600; font-size: 15px; color: var(--mute); }
.seg a.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 12px; }
.strip a { display: flex; flex-direction: column; align-items: center; text-decoration: none; padding: 6px 0; border-radius: 12px; }
.strip .dw { font-size: 12px; color: var(--mute); font-weight: 600; }
.strip .dn { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 17px; }
.strip a.today .dn { border: 2px solid var(--orange); }
.strip a.sel .dn { background: var(--ink); color: #fff; }
.strip .dots { height: 8px; display: flex; gap: 3px; margin-top: 2px; }
.strip .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.strip .dots i.done { background: var(--green); }
.wo { display: block; border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; text-decoration: none; background: var(--blue-soft);
  border-left: 4px solid var(--blue); color: var(--text); font-size: 14px; line-height: 1.3; cursor: grab; touch-action: manipulation; }
.wo.done { background: var(--green-soft); border-left-color: var(--green); }
.wo.overdue { background: var(--orange-soft); border-left-color: var(--orange); }
.wo b { display: block; color: var(--ink); }
.wo .mv { float: right; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; font: 600 12px var(--body); padding: 6px 8px; margin: -2px -4px 0 6px; cursor: pointer; min-height: 32px; }
.weekgrid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.wday { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-height: 64px; }
.wday.today { border: 2px solid var(--orange); }
.wday h4 { margin: 0 0 6px; font: 600 14px var(--body); color: var(--mute); display: flex; justify-content: space-between; }
.wday h4 a { text-decoration: none; color: var(--blue); }
.wday.drop { background: var(--orange-soft); }
@media (min-width: 900px) { .weekgrid { grid-template-columns: repeat(7, 1fr); } .wday { min-height: 340px; } }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.month .dh { text-align: center; font-size: 12px; font-weight: 600; color: var(--mute); padding: 4px 0; }
.mday { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; min-height: 64px; padding: 3px; text-decoration: none; display: block; overflow: hidden; }
.mday.out { opacity: .45; }
.mday.today { border: 2px solid var(--orange); }
.mday.drop { background: var(--orange-soft); }
.mday .n { font-size: 13px; font-weight: 600; }
.mday .wo { font-size: 11px; padding: 2px 4px; margin-bottom: 2px; border-left-width: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mday .wo .mv { display: none; }
@media (min-width: 900px) { .mday { min-height: 110px; padding: 5px; } .mday .wo { font-size: 12.5px; } }
.dayview .slot { display: grid; grid-template-columns: 64px 1fr; gap: 8px; border-top: 1px solid var(--line); min-height: 52px; padding: 4px 0; }
.dayview .slot .h { font-size: 13px; color: var(--mute); font-weight: 600; padding-top: 2px; }
.dayview .slot.drop { background: var(--orange-soft); }
dialog { border: 0; border-radius: 18px; padding: 18px; width: min(92vw, 420px); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0,0,0,.35); }

/* reports */
.chartbox { overflow-x: auto; }
.chart { display: block; min-width: 100%; height: auto; }
.chart .grid { stroke: var(--wash); stroke-width: 1; }
.chart .zero { stroke: #9aa3ab; stroke-width: 1; }
.chart .ax { font: 500 11px var(--body); fill: var(--mute); }
.chart .lab { font: 600 11px var(--body); fill: var(--mute); }
.chart .lab.sel { fill: var(--ink); }
.chart .hit { fill: transparent; }
.chart .hit.sel { fill: var(--orange-soft); }
.chart a.barlink:hover .hit { fill: var(--wash); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--mute); margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbars .hb { display: grid; grid-template-columns: 120px 1fr 70px; gap: 10px; align-items: center; padding: 6px 0; font-size: 15px; }
.hbars .hb-t { background: var(--wash); border-radius: 6px; height: 14px; overflow: hidden; }
.hbars .hb-f { background: var(--orange); height: 100%; border-radius: 6px; }
.hbars .hb-v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.kv .row { justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--wash); }
.kv .row:last-child { border-bottom: 0; }
.kv .big { font-size: 20px; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th { text-align: left; font-size: 13px; color: var(--mute); padding: 8px 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.data td { padding: 9px 8px; border-bottom: 1px solid var(--wash); }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
.scrollx { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bigfig { font: 600 34px var(--body); color: var(--ink); }

/* login + public pages */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.center .card { width: 100%; max-width: 400px; padding: 22px; }
.logo-big { display: block; width: 190px; margin: 0 auto 16px; }
.pub { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; }
.pub-head { background: var(--ink); border-bottom: 3px solid var(--orange); padding: 14px 16px; text-align: center; }
.pub-head img { height: 64px; }
.pub .total { text-align: center; padding: 18px 0 6px; }
.pub .total .label { color: var(--mute); font-weight: 600; }
.pub .total .fig { font: 600 42px var(--body); color: var(--ink); font-variant-numeric: tabular-nums; }
.opt-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--wash); }
.opt-row .grow { flex: 1; }
.msgbox { font-family: var(--body); }
.note-item { padding: 10px 0; border-bottom: 1px solid var(--wash); }
.paybox { border: 2px dashed var(--line); border-radius: var(--r); padding: 14px 16px; background: #fafbfc; }
@media (min-width: 900px) and (hover: hover) { .weekgrid .wo .mv { display: none; } }
.mday .wo .small { display: none; }
.mday .wo b { font-size: 11px; font-weight: 600; }
@media (min-width: 900px) { .mday .wo .small { display: inline; font-size: 12px; } .mday .wo b { font-size: 12.5px; } }

/* Report tables on phones: each row becomes a small card, so nothing runs off the right edge. */
@media (max-width: 640px) {
  .rtable { padding: 0 !important; background: none; border: 0; overflow: visible; }
  .rtable table.data, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable thead { display: none; }
  .rtable tr { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; margin-bottom: 8px; }
  .rtable td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--wash); text-align: right; }
  .rtable td:last-child { border-bottom: 0; }
  .rtable td::before { content: attr(data-label); color: var(--mute); font-size: 14px; font-weight: 600; text-align: left; flex-shrink: 0; }
  .rtable td:first-child { font-weight: 600; font-size: 17px; color: var(--ink); text-align: left; border-bottom: 2px solid var(--wash); }
  .rtable td:first-child::before { content: none; }
  .rtable td:empty, .rtable td[data-label]:not(:first-child):empty { display: none; }
}

.att.grey { border-left-color: var(--mute); }
.tag.markate { background: #eef0ff; color: #3a43a8; text-transform: none; font-size: 11px; padding: 1px 7px; }

/* address suggestions under the street field */
.addr-sug { position: absolute; left: 0; right: 0; top: 100%; z-index: 50; background: var(--paper); border: 1.5px solid #c4ccd3;
  border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.15); margin-top: 4px; overflow: hidden; }
.addr-sug button { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--wash);
  padding: 10px 14px; min-height: 52px; font: 500 16px var(--body); color: var(--text); cursor: pointer; }
.addr-sug button:last-child { border-bottom: 0; }
.addr-sug button b { display: block; color: var(--ink); font-weight: 600; }
.addr-sug button span { font-size: 14px; color: var(--mute); }
.addr-sug button:active, .addr-sug button:hover { background: var(--wash); }

/* ---------- linked records: the chain strip ---------- */
.chain { display: flex; align-items: stretch; gap: 4px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px 2px; scrollbar-width: none; }
.chain::-webkit-scrollbar { display: none; }
.chain-arrow { align-self: center; color: var(--mute); font-size: 18px; flex-shrink: 0; }
.chip-step { flex-shrink: 0; display: flex; flex-direction: column; justify-content: center; min-height: 58px; min-width: 92px; max-width: 150px; padding: 6px 10px;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); text-decoration: none; color: var(--text); line-height: 1.2; }
.chip-step .cs-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--mute); }
.chip-step .cs-value { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.chip-step .cs-status { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip-step .cs-action { font-size: 12.5px; font-weight: 600; color: var(--blue); }
.chip-step.tone-missing { border-style: dashed; background: #f7f8f9; }
.chip-step.tone-missing .cs-value { color: var(--mute); font-weight: 500; }
.tone-accepted, .tone-done, .tone-paid { border-left: 5px solid var(--green); } .tone-accepted .cs-status, .tone-done .cs-status, .tone-paid .cs-status { color: var(--green); }
.tone-sent, .tone-scheduled { border-left: 5px solid var(--blue); } .tone-sent .cs-status, .tone-scheduled .cs-status { color: var(--blue); }
.tone-unpaid, .tone-partly-paid { border-left: 5px solid var(--orange); } .tone-unpaid .cs-status, .tone-partly-paid .cs-status { color: #a8410b; }
.tone-declined, .tone-cancelled, .tone-void, .tone-expired { border-left: 5px solid #9aa3ab; }
.tone-draft { border-left: 5px solid #9aa3ab; }
.tone-ink { border-left: 5px solid var(--ink); }
.see-all { display: inline-flex; align-items: center; min-height: 40px; font-weight: 600; color: var(--blue); text-decoration: none; margin-bottom: 4px; }

/* ---------- section headings ---------- */
.sec { display: flex; align-items: center; gap: 8px; margin: 22px 0 8px; }
.sec h2 { margin: 0; flex: 1; }
.sec .sec-link { font-weight: 600; color: var(--blue); text-decoration: none; font-size: 15px; }

/* ---------- history feed ---------- */
.feed { list-style: none; margin: 0; padding: 4px 0 4px 0; position: relative; }
.feed::before { content: ""; position: absolute; left: 17px; top: 14px; bottom: 14px; width: 2px; background: var(--line); }
.feed-item { display: flex; gap: 12px; padding: 8px 0; position: relative; }
.feed-dot { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--paper); border: 2px solid var(--line); z-index: 1; }
.feed-dot svg { width: 18px; height: 18px; }
.feed-dot.tone-green { border-color: var(--green); color: var(--green); } .feed-dot.tone-blue { border-color: var(--blue); color: var(--blue); }
.feed-dot.tone-orange { border-color: var(--orange); color: #a8410b; } .feed-dot.tone-red { border-color: var(--red); color: var(--red); }
.feed-dot.tone-yellow { border-color: #e0a500; color: var(--yellow); } .feed-dot.tone-grey { color: var(--mute); }
.feed-body { flex: 1; min-width: 0; padding-top: 6px; }
.feed-title { font-weight: 600; color: var(--ink); text-decoration: none; display: block; }
a.feed-title { color: var(--blue); }
.feed-sub { font-size: 14px; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; max-height: 6.5em; overflow: hidden; }
.feed-when { font-size: 13px; color: var(--mute); margin-top: 2px; }
.feed-photo { display: block; width: 120px; height: 90px; object-fit: cover; border-radius: 8px; margin-top: 6px; }

/* ---------- property card ---------- */
.prop { padding: 0; overflow: hidden; }
.prop-sv { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; }
.prop-map { position: relative; height: 170px; overflow: hidden; background: #e6e9ec; }
.prop-tiles { position: absolute; width: 768px; height: 768px; }
.prop-tiles img { position: absolute; width: 256px; height: 256px; max-width: none; }
.prop-pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); color: var(--orange); filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.prop-pin svg { width: 38px; height: 38px; fill: var(--orange); stroke: #000; stroke-width: 1.2; }
.prop-attr { position: absolute; right: 0; bottom: 0; background: rgba(255,255,255,.85); font-size: 11px; padding: 1px 6px; color: #333; }
.prop-attr a { color: #333; }
.prop-nomap { padding: 12px 16px 0; }
.prop-body { padding: 12px 16px 14px; }
.prop-addr { display: flex; gap: 10px; align-items: center; }
.prop-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.prop-photos { display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; }
.prop-photos img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; display: block; }
.add-photo-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 84px; height: 84px; margin: 0; border: 2px dashed var(--line);
  border-radius: 10px; font-size: 12px; font-weight: 600; color: var(--mute); cursor: pointer; text-align: center; }
.add-photo-btn svg { width: 24px; height: 24px; color: var(--orange); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.formbar.static { position: static; background: none; }
.name-link { color: inherit; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--orange); }

/* ---------- review 2: big numbers keep the brand face; everything else reads in Barlow ---------- */
.bigfig, .stat .v, .pub .total .fig, .totals .grand span:last-child, .rec-head .amount { font-family: var(--display); font-weight: 400; letter-spacing: .01em; }
.rec-head h1 { font-size: 24px; }
.sec h2 { font-size: 20px; }
.btn.small { font-size: 15px; }

/* home: next job + compact attention rows */
.next-job { border-left: 5px solid var(--blue); }
.week-line { font-size: 15px; color: var(--mute); margin: 6px 0 0; }
.att-c { padding: 0; }
.att-row { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 16px; min-height: 60px; text-decoration: none; color: var(--text); flex: 1; min-width: 0; }
.att-row .grow { flex: 1; min-width: 0; }
.att-row .nm { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-row .dt { font-size: 14px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-row .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.att-row .chev { color: var(--mute); font-size: 22px; line-height: 1; }
.att-c .hide-x { padding: 0 12px; font-size: 13px; }
.att-h { padding: 12px 16px 2px; }
.att-h h3 { font-size: 16px; }
.att-hint { font-size: 13.5px; padding-bottom: 8px; }

/* schedule: only days with jobs on phones */
.weeklist { display: grid; gap: 10px; }
.weeklist .empty-days { font-size: 14px; color: var(--mute); padding: 6px 4px; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.weeklist .empty-days a { color: var(--blue); font-weight: 600; text-decoration: none; }
@media (max-width: 899px) { .weekgrid { display: none; } }
@media (min-width: 900px) { .weeklist { display: none; } }

/* customers: letter rail starts below the search box and chips */
.az { top: 250px; }

/* chain strip: a 3-column grid on phones so every step is visible */
@media (max-width: 640px) {
  .chain { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; overflow: visible; }
  .chain-arrow { display: none; }
  .chip-step { min-width: 0; max-width: none; min-height: 54px; padding: 6px 8px; }
  .chip-step .cs-value { font-size: 14px; }
  .chip-step .cs-status, .chip-step .cs-action { font-size: 12px; white-space: normal; }
}

/* property: approximate pin */
.prop-approx { position: absolute; left: 8px; top: 8px; background: rgba(255,255,255,.92); border-radius: 999px; font-size: 12px; font-weight: 600; padding: 3px 10px; color: var(--yellow); border: 1px solid #e0c46a; }
.src-label { display: inline-block; font-size: 12px; font-weight: 600; color: var(--mute); background: var(--grey-soft); border-radius: 999px; padding: 1px 8px; margin-bottom: 4px; }
.title-amount { font-size: 26px; color: var(--ink); margin: -2px 0 4px; }
#pick { scroll-margin-top: 76px; }

/* round 1: today summary, follow-up queue */
.today-sum { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0; overflow: hidden; }
.today-sum a { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 72px; text-decoration: none; color: var(--text);
  border-right: 1px solid var(--wash); padding: 8px 4px; text-align: center; }
.today-sum a:last-child { border-right: 0; }
.today-sum b { font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.today-sum span { font-size: 12.5px; color: var(--mute); font-weight: 600; }
.fu-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.fu-actions .btn.small { min-height: 44px; }
.fu.done { opacity: .5; }
.lead-timer.late { color: var(--red); }
.sync-dot { width: 12px; height: 12px; border-radius: 50%; background: #39b54a; border: 2px solid #000; box-shadow: 0 0 0 1px #fff; flex-shrink: 0; }
.sync-dot.pending { background: var(--orange); } .sync-dot.offline { background: #9aa3ab; }
.offline-bar { background: var(--yellow-soft); color: #5a4000; font-weight: 600; font-size: 14px; padding: 8px 16px; text-align: center; border-bottom: 1px solid #e0c46a; }

/* round 1: one "Add item" dropdown in the estimate / invoice / job editor */
.add-item { position: relative; margin-top: 4px; }
.add-item label { margin-top: 4px; }
.item-pick { position: absolute; left: 0; right: 0; top: 100%; z-index: 50; margin-top: 4px; background: var(--paper); border: 1.5px solid #c4ccd3;
  border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.18); max-height: 56vh; overflow-y: auto; }
.item-pick button { display: flex; width: 100%; gap: 10px; align-items: center; justify-content: space-between; text-align: left; background: none; border: 0;
  border-bottom: 1px solid var(--wash); padding: 10px 14px; min-height: 56px; font: 500 16px var(--body); color: var(--text); cursor: pointer; }
.item-pick button:hover, .item-pick button.on { background: var(--wash); }
.ip-main { display: flex; flex-direction: column; min-width: 0; }
.ip-main b { color: var(--ink); font-weight: 700; }
.ip-desc { font-size: 13.5px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ip-price { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ip-custom { border-top: 2px solid var(--line) !important; }
.editor .it-desc { margin-top: 8px; min-height: 64px; font-size: 15px; }
.ip-head { position: sticky; top: 0; background: #f7f8f9; font-size: 12.5px; font-weight: 700; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; padding: 8px 14px; border-bottom: 1px solid var(--line); z-index: 1; }
.ip-more { display: block; width: 100%; text-align: left; background: #f7f8f9 !important; border: 0; border-top: 2px solid var(--line) !important; padding: 12px 14px !important; font: 700 15px var(--body) !important; color: var(--blue) !important; cursor: pointer; min-height: 48px; }

/* round 1: on-the-spot estimating */
.stepper { display: grid; grid-template-columns: 44px 1fr 44px; gap: 0; border: 1.5px solid #c4ccd3; border-radius: 10px; overflow: hidden; }
.stepper input { border: 0; border-radius: 0; text-align: center; min-height: 48px; padding: 4px; }
.stepper button { border: 0; background: var(--wash); font: 700 22px var(--body); color: var(--ink); cursor: pointer; min-height: 48px; }
.editor .it .qp { grid-template-columns: 136px 1fr auto; }
.sticky-sum { display: flex; justify-content: space-between; align-items: baseline; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; }
.sticky-sum b { font: 400 22px var(--display); color: var(--ink); }
.pkg-panel .pkg-body, .pkg-line { display: none; }
.editor.use-pkgs .pkg-panel .pkg-body, .editor.use-pkgs .pkg-line { display: block; }
.pkg-row { border-top: 1px solid var(--wash); padding: 10px 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; }
.pkg-row .row { grid-column: 1 / -1; }
.pkg-name { font-weight: 700; min-height: 44px; }
.pkg-sum { text-align: right; display: flex; flex-direction: column; }
.pkg-save { color: var(--green); font-weight: 600; }
.upsell { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 6px 0 4px; }
.upsell .lbl { font-size: 13px; font-weight: 700; color: var(--mute); width: 100%; }
.upsell button { min-height: 44px; border-radius: 999px; border: 1.5px dashed var(--blue); background: var(--blue-soft); color: var(--blue); font: 600 14.5px var(--body); padding: 0 14px; cursor: pointer; }
.pkg-card { border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; display: block; cursor: pointer; }
.pkg-card.reco { border-color: var(--orange); }
.pkg-card input { width: 22px; height: 22px; min-height: 0; vertical-align: middle; -webkit-appearance: radio; appearance: auto; }
.pkg-card .pk-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pkg-card .pk-name { font-weight: 700; font-size: 18px; color: var(--ink); }
.pkg-card .pk-total { font: 400 22px var(--display); color: var(--ink); }
.pkg-card ul { margin: 6px 0 0 30px; padding: 0; font-size: 15px; color: var(--text); }
.item-desc { white-space: pre-wrap; max-height: 7.5em; overflow: hidden; }

/* review: compact one-row lines, package tabs, per-package totals at the bottom */
.editor .it { padding: 10px 10px 6px; }
.it-row { display: grid; grid-template-columns: minmax(0, 1fr) 104px 78px; gap: 6px; align-items: center; }
.it-row input { min-height: 46px; padding: 8px 10px; }
.it-name { font-weight: 700; }
.it-price { text-align: right; }
.stepper.sm { grid-template-columns: 32px 1fr 32px; }
.stepper.sm button { min-height: 46px; font-size: 20px; }
.stepper.sm input { min-height: 46px; padding: 2px; }
.it-sub { display: flex; align-items: center; gap: 8px; margin-top: 2px; min-height: 32px; }
.it-more { background: none; border: 0; color: var(--blue); font: 600 14px var(--body); padding: 6px 2px; cursor: pointer; min-height: 32px; }
.it-tags { flex: 1; font-size: 12.5px; color: var(--mute); font-weight: 600; }
.it-sub .lt { font-weight: 700; color: var(--ink); padding: 0; min-width: 0; }
.it-details { padding-top: 4px; }
.it-details .x { width: auto; height: auto; font-size: 14px; color: var(--red); }
.pkg-tabs { display: none; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.editor.use-pkgs .pkg-tabs { display: flex; }
.pkg-tab-hint { display: none; margin: 0 0 8px; }
.editor.use-pkgs .pkg-tab-hint { display: block; }
.pkg-tabs button { flex-shrink: 0; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper);
  font: 700 15px var(--body); color: var(--text); cursor: pointer; }
.pkg-tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.editor .it.off-tab { display: none; }
.editor:not(.use-pkgs) .pkg-line { display: none; }
.editor.use-pkgs .pkg-line { display: block; }
.sticky-pk { display: none; gap: 6px; padding: 6px 8px; }
.editor.use-pkgs .sticky-pk { display: grid; grid-template-columns: repeat(3, 1fr); }
.editor.use-pkgs #sticky-one { display: none; }
.spk { display: flex; flex-direction: column; align-items: center; padding: 4px; border-radius: 10px; }
.spk.reco { background: var(--orange-soft); outline: 2px solid var(--orange); }
.spk-n { font-size: 12.5px; font-weight: 700; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.spk-t { font: 400 18px var(--display); color: var(--ink); }
/* tighter lines and a two-button bottom bar so about six lines fit one phone screen */
.editor .it { padding: 7px 8px 4px; margin-bottom: 6px; border-radius: 12px; }
.it-row input, .stepper.sm button, .stepper.sm input { min-height: 44px; }
.it-sub { min-height: 26px; margin-top: 0; }
.it-more { min-height: 26px; padding: 2px; }
.editor .formbar { grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 0 8px; }
.editor .formbar .sticky-sum { grid-column: 1 / -1; padding: 4px 12px; }
.editor .formbar .btn { min-height: 48px; padding: 0 10px; }
.editor .formbar .btn.block:only-of-type { grid-column: 1 / -1; }

/* PDF previews drawn as pictures (his preview and the customer's link) */
.paper-pages { display: grid; gap: 10px; margin-bottom: 12px; }
.paper-page { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.paper-actions { position: sticky; bottom: calc(var(--tab-h) + var(--safe-b)); z-index: 6; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  background: linear-gradient(to top, var(--bg) 80%, transparent); padding: 10px 0; }
@media (min-width: 900px) { .paper-actions { bottom: 0; grid-template-columns: repeat(4, 1fr); } .paper-pages { max-width: 760px; } }
.btn.view-pdf { width: 100%; margin: 4px 0 12px; }

/* customer link: signature step */
.pub-paper { margin: 12px 0 16px; }
.sign-step { display: none; border: 2px solid var(--orange); margin-top: 12px; }
.sign-step.open, .no-js .sign-step { display: block; }
.sig-wrap { position: relative; border: 2px dashed #9aa3ab; border-radius: 12px; background: #fff; touch-action: none; }
.sig-wrap canvas { display: block; width: 100%; height: 160px; touch-action: none; cursor: crosshair; }
.sig-wrap::after { content: "Sign here"; position: absolute; left: 14px; bottom: 10px; color: #c4ccd3; font-size: 14px; pointer-events: none; }
.sig-clear { position: absolute; right: 6px; top: 2px; }

/* inline PDF preview on record pages; tap to enlarge */
.paper-thumbs { display: flex; gap: 8px; overflow-x: auto; background: none; border: 0; padding: 0; cursor: zoom-in; width: 100%; }
.paper-thumb { width: 46%; min-width: 150px; max-width: 260px; height: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.paper-thumbs .paper-thumb:only-child { width: 100%; max-width: 420px; }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(20,22,24,.92); overflow-y: auto; padding: 0 10px 20px; }
.lightbox-bar { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; color: #fff; padding: 12px 4px; background: rgba(20,22,24,.95); }
.lightbox-pages { display: grid; gap: 10px; max-width: 820px; margin: 0 auto; }

/* ---------- big screens (his 45-inch monitor and any screen 1280 px or wider). Phones are unchanged. ---------- */
.wtable, .live-paper { display: none; }
@media (min-width: 900px) and (max-width: 1279px) { main > .wrap.wide { max-width: 980px; } }
@media (min-width: 1280px) {
  body { font-size: 18.5px; }
  .small { font-size: 15.5px; }
  h1 { font-size: 30px; }
  h2 { font-size: 22px; }
  .side { width: 264px; padding: 22px 16px; }
  .side img { width: 172px; }
  .side a { font-size: 18px; padding: 12px 14px; }
  .side .sub { font-size: 16px; padding-left: 50px; }
  .topbar, .demo-strip { margin-left: 264px; }
  .topbar .ttl { font-size: 19px; }
  main { margin-left: 264px; padding: 26px 40px 70px; }
  main > .wrap { max-width: 1180px; margin: 0 auto; }
  main > .wrap.wide { max-width: 1600px; }
  .wide-hide { display: none !important; }

  /* Home: a dashboard. Today | Leads, Ready to send, Needs attention, with the month's money under Today */
  .dash { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); grid-template-rows: auto 1fr; gap: 0 34px; align-items: start; }
  .dA { grid-column: 1; grid-row: 1; }
  .dB { grid-column: 2; grid-row: 1 / span 2; }
  .dC { grid-column: 1; grid-row: 2; }
  .dB { display: flex; flex-direction: column; }
  .dB .blk-leads { order: 1; } .dB .blk-att { order: 2; } .dB .blk-ready { order: 3; }
  .dB .blk > .sec:first-child, .dB .blk > h2:first-child { margin-top: 6px; }
  .dB .blk:empty { display: none; }
  .dash .today-sum b { font-size: 26px; }

  /* lists become tables */
  .wtable { display: table; width: 100%; border-collapse: separate; border-spacing: 0; background: var(--paper);
    border: 1px solid var(--line); border-radius: var(--r); font-size: 17px; }
  .wtable th:first-child { border-top-left-radius: var(--r); } .wtable th:last-child { border-top-right-radius: var(--r); }
  .wtable th { text-align: left; font-size: 14px; font-weight: 600; color: var(--mute); text-transform: uppercase; letter-spacing: .04em;
    background: var(--wash); padding: 10px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 59px; z-index: 2; }
  .wtable td { padding: 11px 14px; border-bottom: 1px solid var(--wash); vertical-align: middle; }
  .wtable tbody tr { cursor: pointer; }
  .wtable tbody tr:hover td { background: #fbf7f4; }
  .wtable tbody tr:last-child td { border-bottom: 0; }
  .wtable td a { color: var(--ink); font-weight: 600; text-decoration: none; }
  .wtable td a:hover { text-decoration: underline; }
  .wtable .r { text-align: right; }
  .wtable td.em { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* estimate / invoice builder: the lines on the left, the paper as the customer will see it on the right */
  .builder.has-live { display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 0.92fr); gap: 34px; align-items: start; }
  .live-paper { display: block; position: sticky; top: 78px; max-height: calc(100vh - 96px); overflow: auto;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
  .lp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 2px 10px; }
  .lp-pages { display: grid; gap: 12px; min-height: 300px; }
  .lp-page { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
}
@media (min-width: 1280px) and (max-width: 1499px) { .wtable .xw { display: none; } }
@media (min-width: 1700px) {
  .dash { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, .72fr); grid-template-rows: auto; }
  .dB { grid-row: 1; }
  .dC { grid-column: 3; grid-row: 1; }
  .dC > h2:first-child { margin-top: 6px; }
  .dC .stats { grid-template-columns: 1fr; }
  .dC .stats .stat .v { font-size: 34px; }
}

/* ---------- smart customer search: highlights, why it matched, sort toggle, top-bar search ---------- */
mark { background: #ffe1c7; color: inherit; border-radius: 3px; padding: 0 1px; }
.why { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.why span { font-size: 12px; font-weight: 600; color: #6b3a12; background: var(--orange-soft); border-radius: 999px; padding: 1px 8px; line-height: 1.5; }
.list-meta { align-items: center; }
.sortseg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--paper); flex: none; }
.sortseg a { padding: 5px 12px; text-decoration: none; color: var(--mute); font-weight: 600; min-height: 32px; display: inline-flex; align-items: center; }
.sortseg a.on { background: var(--ink); color: #fff; }

.ts-open { flex: none; width: 40px; height: 40px; border: 0; background: none; color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.ts-open svg { width: 24px; height: 24px; }
.tsearch { display: none; }
.tsearch .ts-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--mute); display: flex; pointer-events: none; }
.tsearch .ts-ico svg { width: 18px; height: 18px; }
.tsearch input { width: 100%; min-height: 40px; border-radius: 10px; border: 0; padding: 0 36px 0 38px; font: 500 16px var(--body); background: #fff; color: var(--text); }
.tsearch .ts-close { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; font-size: 24px; color: var(--mute); width: 30px; height: 30px; cursor: pointer; }
.tsearch.open { display: flex; position: absolute; left: 0; right: 0; bottom: 0; top: 0; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); background: var(--ink); align-items: center; z-index: 5; }
.tsearch.open .ts-ico { left: 24px; top: calc(50% + env(safe-area-inset-top, 0px) / 2); }
.tsearch.open .ts-close { right: 18px; top: calc(50% + env(safe-area-inset-top, 0px) / 2); }
.ts-drop { position: absolute; left: 8px; right: 8px; top: calc(100% + 4px); background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18); max-height: 70vh; overflow: auto; z-index: 50; }
.ts-drop a { display: block; padding: 10px 14px; border-bottom: 1px solid var(--wash); text-decoration: none; color: var(--text); }
.ts-drop a b { display: block; color: var(--ink); font-weight: 600; }
.ts-drop a .s { display: block; font-size: 14px; color: var(--mute); }
.ts-drop a.sel, .ts-drop a:hover { background: #fbf7f4; }
.ts-drop .ts-all { font-weight: 600; color: var(--blue); }
@media (min-width: 900px) {
  .ts-open { display: none; }
  .tsearch { display: block; position: relative; width: 340px; flex: none; }
  .tsearch .ts-close { display: none; }
  .ts-drop { left: auto; right: 0; width: 460px; }
}
@media (min-width: 1280px) { .tsearch { width: 440px; } .tsearch input { font-size: 17px; } }
.tsearch input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }

/* ---------- auto-measure quote (estimate builder) ---------- */
.measure-open { margin-top: 10px; }
.measure-open svg { width: 18px; height: 18px; }
.measure { margin-top: 12px; border-color: var(--orange); }
.ms-map { position: relative; height: 300px; overflow: hidden; background: #e6e9ec; border-radius: 10px; margin-bottom: 6px; }
.ms-layer { position: absolute; width: 768px; height: 768px; }
.ms-layer img { position: absolute; width: 256px; height: 256px; filter: grayscale(.35) contrast(.95); }
.ms-layer svg { position: absolute; left: 0; top: 0; width: 768px; height: 768px; }
.ms-layer .ms-main { fill: rgba(241,104,35,.35); stroke: var(--orange); stroke-width: 3; }
.ms-layer .ms-other { fill: rgba(0,0,0,.06); stroke: #555; stroke-width: 1.5; stroke-dasharray: 4 3; cursor: pointer; }
.ms-layer .ms-other:hover { fill: rgba(37,99,168,.18); stroke: var(--blue); }
.ms-layer .ms-pin { fill: var(--ink); stroke: #fff; stroke-width: 2; }
.ms-layer .ms-label { font: 700 15px var(--body); fill: #000; paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.ms-form { margin-top: 6px; }
.ms-form label { margin-top: 8px; }
.ms-range { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.ms-fig { font-family: var(--display); font-size: 30px; color: var(--ink); margin: 2px 0 8px; }
.ms-add { display: flex; gap: 8px; flex-wrap: wrap; }
.ms-add .btn { flex: 1 1 160px; }

/* ---------- customer map, day route, yard signs ---------- */
.cmap { height: calc(100vh - 230px); min-height: 380px; border-radius: var(--r); border: 1px solid var(--line); margin: 8px 0; z-index: 1; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.mlg { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; margin: 0; min-height: 34px; cursor: pointer; }
.mlg .dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.mlg b { color: var(--mute); font-weight: 600; }
.day-route { margin: 0 0 10px; }
.day-route svg, .route-btns svg { width: 18px; height: 18px; }
.route-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.route-btns .btn { flex: 1 1 160px; }
.route-list { padding: 0; list-style: none; }
.route-list .rn { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.sign-counts { display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap; }
.sign-counts b { font-size: 26px; color: var(--ink); margin-right: 6px; }
.sign-streets { margin: 6px 0 10px; padding-left: 22px; }
.sign-streets li { margin: 3px 0; }
