/* QuoteDesk — polish layer                                                      v20261113a
 *
 * One additive stylesheet. It changes no data, no behaviour and no wording: only how screens
 * that already exist are drawn. Written against the live build of 13 Nov 2026
 * (index-qRu9nQ_B.js sha256 63f5d7cd…, index-C0IMbQeY.css sha256 fb700abd…).
 *
 * Every rule that overrides an app rule starts with :root, so it wins on weight and does not
 * depend on where the <link> sits in <head> (page stylesheets are added to <head> later by the
 * app, after this file). Rules that override an inline style say !important and nothing else does.
 *
 * To roll back: remove the two qd_polish tags from index.html. The files can stay.
 *
 * Sections
 *   1. Colour names used by newer screens but never defined
 *   2. Form controls the app left as browser defaults
 *   3. Pipeline: a board that fits the screen (and, on a phone, stages that open and close)
 *   4. Home and sidebar
 *   5. Take a payment / Collections fields match the rest of the app
 *   6. Messages header
 *   7. My day: Past jobs fold (needs qd_polish.js; without it nothing folds)
 */

/* ---------- 1. Colour names used by newer screens but never defined ----------
 * Take a payment, Collections and ChaseTop style themselves with --card, --accent, --muted and
 * --shadow; My day, Messages, Pipeline and Estimates use --danger, --brand-50/200/300, --link,
 * --bad, --bg2, --well and --ok-bg. None of them exists in the app stylesheet, so those screens
 * fall back to nothing (no card surface, no accent border, error text in the body colour) or to
 * a light-theme colour on the dark theme (the white pills on Messages, the blue links on
 * Pipeline). Each name now points at the matching token, so it follows light and dark. */
:root {
  --card: var(--surface);
  --accent: var(--brand);
  --muted: var(--ink-3);
  --shadow: var(--shadow-1);
  --danger: var(--no);
  --bad: var(--no);
  --ok-bg: var(--ok-tint);
  --well: var(--sunk);
  --bg2: var(--surface-2);
  --brand-50: var(--brand-tint);
  --brand-200: var(--brand-tint-2);
  --brand-300: color-mix(in srgb, var(--brand) 40%, var(--line-2));
  --link: var(--info);
}

/* ---------- 2. Form controls the app left as browser defaults ---------- */

/* drop-downs with no class (Pipeline "Any value", Housecall Pro estimates) get the app's field look */
:root .main select:not([class]):not([multiple]):not([size]) {
  height: 44px;
  min-width: 0;
  padding: 0 38px 0 14px;
  border: 1.5px solid var(--line-2);
  border-radius: 12px;
  background-color: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
:root .main select:not([class]):not([multiple]):not([size]):hover { border-color: var(--ink-3); }
:root .main select:not([class]):not([multiple]):not([size]):focus-visible {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 10%, transparent);
}

/* ...with the app's own arrow. Drop-downs that already have a class (.select, .input) are left exactly as they
   are, so no field in an estimate line changes width. */
:root .main select:not([class]):not([multiple]):not([size]) {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23958A7E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  padding-right: 38px;
}

/* "Choose file": the browser's grey button becomes one of the app's buttons */
:root .main input[type="file"]:not([class]) {
  max-width: 100%;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink-3);
}
:root .main input[type="file"]:not([class])::file-selector-button {
  -webkit-appearance: none;
  appearance: none;
  height: 40px;
  margin-right: 12px;
  padding: 0 14px;
  border: 1.5px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color .15s;
}
:root .main input[type="file"]:not([class])::file-selector-button:hover { border-color: var(--ink-3); }

/* the Analytics tab strip and the Pipeline board keep their thin scroll bar, in the theme's own grey
   (chip strips hide theirs on purpose and are not touched) */
:root .main .tablist,
:root .main .lanes { scrollbar-color: var(--line-2) transparent; }

/* tick boxes and radio buttons the app left as browser defaults: the brand colour instead of the browser's blue, and
   big enough to hit. Written with :where() so the selector has NO weight beyond "input": every rule the app wrote
   for its own tick boxes (Analytics switches at 20px, Team Board at 20px ...) still wins, whatever the order. */
:where(.main) input:where([type="checkbox"], [type="radio"]):where(:not([class])) {
  accent-color: var(--brand);
  cursor: pointer;
}
:where(.main) input:where([type="checkbox"], [type="radio"]):where(:not([class]):not([style])) {
  width: 18px;
  height: 18px;
  flex: none;
}
:where(.main) input:where([type="checkbox"], [type="radio"]):where(:disabled) { cursor: default; }

/* ---------- 3. Pipeline: a board that fits the screen ----------
 * Before: every column listed every card down the page, so the page was about 50,000px tall and
 * the Jobs and Quotes boards sat tens of screens below the Estimates board. Now each column
 * scrolls on its own under its heading and each board is about one screen tall. Phones keep the
 * layout they have. */
@media (min-width: 641px) and (min-height: 620px) {
  :root .page .lanes > .col {
    max-height: min(74vh, 800px);
    overflow: hidden auto;
    padding: 0 4px 6px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--line-2) transparent;
  }
  :root .page .lanes > .col > * { flex-shrink: 0; }
  :root .page .lanes > .col > .card:focus-visible { outline-offset: -2px; }   /* drawn inside the card: the column clips anything outside */
  :root .page .lanes > .col > .pipeline-col-head { z-index: 1; box-shadow: 0 6px 10px -8px rgba(0, 0, 0, .45); }
}

/* card top line: the source tag is smaller so the customer name gets the room; where it only
   repeats the board's own title (qd_polish.js checks every card) it is left out */
:root .lanes > .col > .card:not(.pipeline-col-head) .badge {
  min-height: 20px;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 11.5px;
}
:root section[data-qdp-src="same"] .lanes > .col > .card:not(.pipeline-col-head) > .row.sp:nth-child(-n+2) .badge { display: none; }   /* row is child 1, or child 2 while this card's menu is open */
:root .lanes > .col > .card:not(.pipeline-col-head) .t-strong { overflow-wrap: anywhere; }

/* the card's "⋯" menu button was a raw browser button */
:root .lanes .card button[aria-label^="Card menu"],
:root .lanes .card > .row.sp > .row > button:not([class]) {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;                 /* a floor, not a size: where the app sets its own larger minimum inline, that wins */
  min-height: 30px;
  padding: 0 !important;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background .12s, color .12s;
}
:root .lanes .card button[aria-label^="Card menu"]:hover,
:root .lanes .card > .row.sp > .row > button:not([class]):hover { background: var(--sunk); color: var(--ink); }
@media (pointer: coarse) {
  :root .lanes .card button[aria-label^="Card menu"],
  :root .lanes .card > .row.sp > .row > button:not([class]) { min-width: 40px; min-height: 40px; }
}

/* the menu it opens: rows instead of raw browser buttons */
:root .main [role="menu"].card { box-shadow: var(--shadow-3); border-color: var(--line-2); }
:root .main [role="menu"].card > button[role="menuitem"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px !important;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
:root .main [role="menu"].card > button[role="menuitem"]:hover:not(:disabled) { background: var(--sunk); }
:root .main [role="menu"].card > button[role="menuitem"]:disabled { opacity: .5; cursor: default; }

/* "Open customer" reads as a link and is easier to hit */
:root .lanes .card > span[role="button"].t-sm {
  align-self: flex-start;
  padding: 4px 0;
  text-underline-offset: 3px;
}
:root .lanes .card > span[role="button"].t-sm:hover { text-decoration: underline; }

/* step chips inside a card: a little lower with a mouse, full height on touch */
@media (pointer: fine) {
  :root .lanes .card .chips .chip { height: 36px; padding: 0 12px; font-size: 14.5px; }
}

/* Pipeline on a phone: the stages are stacked down the page. Each stage heading opens and closes
   its own cards (set by qd_polish.js; it starts closed, and opens by itself while a filter is on) */
:root .lanes > .col[data-qdp-fold] > .pipeline-col-head {
  min-height: 0 !important;
  padding-right: 44px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
:root .lanes > .col[data-qdp-fold] > .pipeline-col-head::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -7px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg);
  transition: transform .15s var(--ease);
}
:root .lanes > .col[data-qdp-fold="open"] > .pipeline-col-head::after { transform: rotate(-135deg); margin-top: -2px; }
/* a closed stage says how many of its cards have the amber "waiting too long" border */
:root .lanes > .col[data-qdp-fold="closed"] > .pipeline-col-head[data-qdp-flag]::before {
  content: attr(data-qdp-flag);
  position: absolute;
  right: 44px;
  bottom: 12px;
  box-sizing: border-box;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--warn-line);
  border-radius: 999px;
  background: var(--warn-tint);
  color: var(--warn);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
:root[data-qd-route="pipeline"] .lanes > .col[data-qdp-fold="closed"] > :not(.pipeline-col-head) { display: none !important; }
:root .lanes > .col[data-qdp-fold="closed"] { gap: 0 !important; }
/* while the app is drawing or redrawing the board a stacked stage is already closed, so a phone never lays out the
   whole 400-card list first. html[data-qdp-stacked] is set by the script (on a phone, before the first board; after
   that only when it has seen the stages stacked) and removed if it sees otherwise, if a filter is on, or if it fails. */
@media (max-width: 640px) {
  :root[data-qdp-stacked]:not([data-qdp-filter]) .pipeline-compact .lanes > .col:has(> .pipeline-col-head):not([data-qdp-fold="open"]) > :not(.pipeline-col-head) { display: none !important; }
}

/* the Pipeline page may use a wide screen (needs qd_polish.js for the route name) */
@media (min-width: 1500px) {
  :root[data-qd-route="pipeline"] .page { max-width: 1760px; }
}

/* ---------- 4. Home and sidebar ---------- */

/* Home shortcuts: four across on a desktop instead of two very wide tiles and two full-width bars, so open
   estimates and follow-ups come up the page */
@media (min-width: 1000px) {
  :root .page > .quick { display: flex; flex-wrap: wrap; }
  :root .page > .quick > .qa { flex: 1 1 calc(25% - 16px); min-width: 0; }   /* four across; a shorter last row stretches to fill */
}

/* sidebar with a mouse: 27 links are closer together, so far fewer are below the fold */
@media (min-width: 901px) and (pointer: fine) {
  :root .rail { gap: 2px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
  :root .rail .navlink { min-height: 38px; padding-top: 5px; padding-bottom: 5px; border-radius: 10px; font-size: 15px; line-height: 19px; }
  :root .rail .navlink svg { width: 19px; height: 19px; }
}

/* ---------- 5. Take a payment / Collections fields match the rest of the app ---------- */
:root .main .pay-inp,
:root .main .col-inp {
  min-height: 48px;
  border: 1.5px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
:root .main .pay-inp:focus,
:root .main .col-inp:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 10%, transparent);
}
:root .main .pay-inp::placeholder,
:root .main .col-inp::placeholder { color: var(--ink-4); }

/* ---------- 6. Messages header (needs qd_polish.js for the route name) ----------
 * On the Messages list (not inside a conversation) the five "updated" lines sit on one wrapping row instead of five
 * rows. The block is matched by its shape: a plain column of small status rows, second on the page. */
:root[data-qd-route="messages"][data-qd-leaf] .page > .col:nth-child(2):not(.card):has(> .t-sm.row):not(:has(> :not(.t-sm.row))) {
  flex-direction: row;
  flex-wrap: wrap;
  column-gap: 18px !important;
  row-gap: 2px !important;
}

/* ---------- 7. My day: Past jobs fold (set by qd_polish.js) ----------
 * My day was about 35,000px tall and about 26,000px of that was Past jobs. The section now
 * opens and closes from its own heading and starts closed. */
:root section.section[data-qdp-fold] > .dayhead {
  align-items: center;
  min-height: 44px;
  padding: 4px 2px;
  border-radius: 10px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
:root section.section[data-qdp-fold] > .dayhead::after {
  content: attr(data-qdp-label);
  margin-left: auto;
  flex: none;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1.5px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 650;
}
:root section.section[data-qdp-fold] > .dayhead:hover::after { border-color: var(--ink-3); }
:root[data-qd-route="day"] section.section[data-qdp-fold="closed"] > :not(.dayhead) { display: none !important; }
:root section.section[data-qdp-fold] > .dayhead > [data-qdp-btn] { border-radius: 6px; }
