/* Pipeline board (.pl-), deals table (.pl-tbl-) and deal drawer (.dl-). Tokens only, from base.css. */

/* "Urgent" has its own amber, so it never reads as an error: red is kept for the main button and for delays.
   Text on the amber fill is about 8.6:1 in both themes; the side band is 3:1 or more against the card. */
.pl-urgent, .pl-card, .pl-flag-urgent { --pl-urg-bg: #f2a93b; --pl-urg-ink: #2a1700; --pl-urg-band: #c77a00; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pl-urgent, :root:not([data-theme="light"]) .pl-card, :root:not([data-theme="light"]) .pl-flag-urgent { --pl-urg-bg: #e9a04a; --pl-urg-ink: #1d1200; --pl-urg-band: #e9a04a; }
}
:root[data-theme="dark"] .pl-urgent, :root[data-theme="dark"] .pl-card, :root[data-theme="dark"] .pl-flag-urgent { --pl-urg-bg: #e9a04a; --pl-urg-ink: #1d1200; --pl-urg-band: #e9a04a; }

/* ---------- pipeline: toolbar ---------- */
.pl-head .pl-tools { gap: 8px; flex-wrap: wrap; }
.pl-search { position: relative; width: 220px; }
.pl-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.pl-search .input { padding-left: 32px; min-height: 36px; }
.pl-head .seg button { min-height: 32px; }
.pl-flags { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.pl-flag { min-height: 36px; padding: 6px 11px; color: var(--muted); }
.pl-flag svg { width: 15px; height: 15px; flex: none; }
.pl-flag:hover { color: var(--text); }
.pl-flag.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.pl-flag.pl-flag-urgent.on { background: var(--pl-urg-bg); border-color: var(--pl-urg-band); color: var(--pl-urg-ink); }
.pl-nav { display: inline-flex; gap: 4px; }
.pl-navbtn { min-width: 36px; min-height: 36px; justify-content: center; color: var(--muted); }
.pl-navbtn svg { width: 16px; height: 16px; }
.pl-navbtn:disabled { opacity: .4; cursor: default; }
.pl-flip svg { transform: rotate(180deg); }
.pl-new { min-height: 36px; }
.pl-none { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pl-none p { margin: 0; }

/* ---------- pipeline: board ---------- */
/* the board fills the screen under the header (--pl-top is set by pipeline.js), so the sideways scroll bar is always visible;
   each column scrolls on its own */
.pl-tabs { display: none; }
.pl-board { display: flex; gap: 14px; overflow-x: auto; overflow-y: hidden; align-items: stretch; padding-bottom: 10px;
  height: calc(100vh - var(--pl-top, 220px) - 14px); height: calc(100dvh - var(--pl-top, 220px) - 14px); min-height: 380px;
  scroll-snap-type: x proximity; scrollbar-width: auto; scrollbar-color: var(--faint) transparent; }
.pl-board:focus { outline: none; }
.pl-board::-webkit-scrollbar { height: 12px; }
.pl-board::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--faint) 70%, transparent); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
.pl-board::-webkit-scrollbar-track { background: transparent; }
.pl-col { flex: 0 0 288px; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-card); scroll-snap-align: start; transition: background-color .12s, border-color .12s; }
.pl-col.is-over { background: color-mix(in srgb, var(--focus) 9%, var(--surface-2)); border-color: var(--focus); }
.pl-col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px; flex: none; }
.pl-col-name { font-size: 14.5px; font-weight: 650; }
.pl-col-n { font-size: 12.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line-soft); border-radius: 999px; padding: 0 8px; line-height: 20px; }
.pl-col-meta { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.pl-cards { display: flex; flex-direction: column; gap: 10px; padding: 0 10px 12px; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.pl-empty { margin: 4px 4px 0; padding: 16px 12px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- pipeline: card ---------- */
.pl-card { position: relative; flex: none; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; cursor: grab; transition: border-color .12s, box-shadow .12s, transform .12s, opacity .12s; }
.pl-card:hover { border-color: var(--line); }
.pl-card:focus-within { border-color: var(--line); }
.pl-card.is-urgent { border-left: 5px solid var(--pl-urg-band); padding-left: 9px; }
.pl-card.is-dragging { box-shadow: var(--shadow); transform: rotate(1deg); }
.pl-card.is-ghost { opacity: .35; transform: none; box-shadow: none; }
.pl-card.is-moving { opacity: .7; }
.pl-card-top { display: flex; align-items: center; gap: 6px; min-height: 22px; }
.pl-urgent { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--pl-urg-ink); background: var(--pl-urg-bg); padding: 0 7px; border-radius: var(--r-chip); line-height: 20px; white-space: nowrap; }
.pl-urgent svg { width: 12px; height: 12px; }
.pl-days { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); padding: 1px 6px; border-radius: var(--r-chip); white-space: nowrap; }
.pl-days svg { width: 12px; height: 12px; }
.pl-days.warn { background: var(--warn-bg); color: var(--warn); font-weight: 560; }
.pl-days.bad { background: var(--bad-bg); color: var(--bad); font-weight: 560; }
.pl-star { position: relative; z-index: 1; display: inline-grid; place-items: center; width: 36px; height: 36px; margin: -8px -6px -8px -4px; padding: 0; background: none; border: 0; border-radius: 8px; color: var(--faint); cursor: pointer; flex: none; }
.pl-star svg { width: 17px; height: 17px; }
.pl-star:hover { color: var(--text); }
.pl-star.on { color: var(--text); } /* filled star in ink, so it never looks like the amber Urgent mark */
.pl-more { position: relative; z-index: 1; min-width: 36px; min-height: 36px; margin: -8px -8px -8px 0; justify-content: center; color: var(--muted); }
.pl-open { display: block; background: none; border: 0; padding: 0; margin: 2px 0 0; text-align: left; cursor: pointer; min-width: 0; width: 100%; color: var(--text); }
.pl-open::after { content: ''; position: absolute; inset: 0; border-radius: 8px; }
.pl-open:focus-visible { outline: none; }
.pl-open:focus-visible::after { outline: 2px solid var(--focus); outline-offset: 1px; }
.pl-name { display: block; font-weight: 650; font-size: 16px; line-height: 1.3; max-width: 100%; }
.pl-veh-row { display: flex; align-items: baseline; gap: 8px; min-width: 0; margin-top: -2px; }
.pl-veh { flex: 1; min-width: 0; color: var(--muted); font-size: 13px; }
.pl-val { flex: none; font-size: 12.5px; color: var(--muted); }
.pl-info { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.pl-next { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); min-width: 0; }
.pl-next svg { width: 14px; height: 14px; flex: none; color: var(--muted); }
.pl-next .clip { flex: 1; min-width: 0; }
.pl-next.is-late, .pl-next.is-late svg { color: var(--bad); font-weight: 560; }
.pl-signs { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.pl-sign { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.pl-sign svg { width: 14px; height: 14px; flex: none; }
.pl-sign.is-todo { color: var(--text); }
.pl-sign.is-todo svg { color: var(--warn); }
.pl-card-foot { display: none; }
.pl-move { position: relative; z-index: 1; min-height: 36px; color: var(--muted); }
.pl-move:hover, .pl-more:hover { color: var(--text); }

/* ---------- new customer modal ---------- */
.pl-nc-intro { margin: 0 0 14px; color: var(--muted); }
.pl-nc-err { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; background: var(--bad-bg); color: var(--bad); font-weight: 560; }
.pl-nc-sec + .pl-nc-sec { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.pl-nc-sec h3 { font-size: 14.5px; margin: 0 0 10px; }
.pl-nc-addr { min-height: 72px; }
.pl-nc-radios { display: flex; flex-wrap: wrap; gap: 8px; border: 0; margin: 0; padding: 0; }
.pl-nc-radio { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); cursor: pointer; }
.pl-nc-radio:has(input:checked) { border-color: var(--text); background: var(--surface-2); font-weight: 560; }
.pl-nc-radio input { margin: 0; }
.pl-nc-hint { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------- deals table ---------- */
.pl-tbl-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.pl-tbl-filters .seg button { min-height: 32px; }
.pl-tbl-sel { width: auto; min-height: 36px; max-width: 220px; }
.pl-tbl-search { flex: 1; min-width: 200px; max-width: 360px; width: auto; }
.pl-tbl th { padding: 0; }
.pl-sort { display: inline-flex; align-items: center; gap: 4px; width: 100%; padding: 9px 12px; background: none; border: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; min-height: 36px; }
.pl-tbl th.right .pl-sort { justify-content: flex-end; }
.pl-sort:hover, .pl-sort.on { color: var(--text); }
.pl-sort .pl-sort-ic { width: 12px; height: 12px; opacity: 0; transform: rotate(90deg); transition: transform .12s; }
.pl-sort.on .pl-sort-ic { opacity: 1; }
.pl-sort.on.asc .pl-sort-ic { transform: rotate(-90deg); }
.pl-tbl-client { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pl-tbl-open { display: block; max-width: 100%; background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; text-align: left; }
.pl-tbl-open:hover { text-decoration: underline; }
.pl-tbl-veh { display: block; max-width: 260px; }
.pl-tbl td.warn { color: var(--warn); font-weight: 600; }
.pl-tbl td.bad { color: var(--bad); font-weight: 600; }
.pl-only-mobile { display: none; }

/* ---------- deal drawer ---------- */
.dl-drawer .dl-head { gap: 10px; }
.dl-titlebox { min-width: 0; }
.dl-titlebox h2 { font-size: 17px; }
.dl-sub { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.dl-body { display: flex; flex-direction: column; gap: 12px; }
.dl-sec { padding: 14px 16px; }
.dl-sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-height: 28px; }
.dl-sec-head h3 { font-size: 14.5px; }
.dl-right { margin-left: auto; display: inline-flex; gap: 4px; align-items: center; font-size: 12.5px; }
.dl-hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.dl-label { font-size: 12.5px; color: var(--muted); font-weight: 520; margin-bottom: 4px; }
.dl-none { margin: 0 0 4px; display: flex; align-items: center; gap: 6px; }
.dl-none svg { width: 15px; height: 15px; flex: none; }
.dl-none.warn { font-weight: 560; }
.dl-form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dl-modal-note { margin: 0 0 12px; color: var(--muted); }

/* stepper */
.dl-stepbox { display: flex; flex-direction: column; gap: 8px; }
.dl-steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 2px 2px 4px; overflow-x: auto; scrollbar-width: thin; }
.dl-steps li { flex: none; }
.dl-step { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 560; cursor: pointer; white-space: nowrap; }
.dl-step svg { width: 14px; height: 14px; }
.dl-step:hover { color: var(--text); border-color: var(--faint); }
.dl-step.past { color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, var(--line)); }
.dl-step.now { background: var(--ink); border-color: var(--ink); color: var(--surface); cursor: default; }
.dl-steps.is-lost .dl-step.now { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--faint); cursor: pointer; }
.dl-steps-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.dl-steps-foot .btn { min-height: 32px; }
.dl-lost { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r-card); background: var(--bad-bg); color: var(--bad); }
.dl-lost-when { font-size: 12.5px; opacity: .85; }

/* next step */
.dl-next-main { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border-left: 4px solid var(--plate); }
.dl-next-main.is-late { border-left-color: var(--bad); }
.dl-next-text { font-weight: 620; font-size: 15px; }
.dl-next-due { display: flex; align-items: center; gap: 5px; font-size: 13px; margin-top: 2px; }
.dl-next-due svg { width: 14px; height: 14px; }
.dl-tasks { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; }
.dl-tasks li { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line-soft); }
.dl-task-due { font-size: 12.5px; white-space: nowrap; }
.dl-addtask { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.dl-addtask-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dl-addtask-row .seg button { min-height: 32px; }
.dl-due { width: auto; flex: 1; min-width: 180px; min-height: 36px; }

/* shared check row (tasks, checklist, ad flags): the whole row is the tap target */
.dl-checkbtn { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; min-height: 38px; padding: 6px 2px; background: none; border: 0; text-align: left; cursor: pointer; color: var(--text); }
.dl-checkbtn .check { pointer-events: none; }
.dl-checkbtn:hover .check { border-color: var(--good); }

/* contact */
.dl-cname { font-size: 15px; font-weight: 620; margin-bottom: 8px; }
.dl-links { display: flex; flex-wrap: wrap; gap: 6px; }
.dl-links .btn { min-height: 36px; max-width: 100%; text-decoration: none; }
.dl-mail { min-width: 0; }
.dl-others { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.dl-other { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 6px 8px; margin: 0 -8px; background: none; border: 0; border-radius: 6px; text-align: left; cursor: pointer; color: var(--text); width: calc(100% + 16px); }
.dl-other:hover { background: var(--surface-2); }

/* quick log */
.dl-log-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.dl-log-btns .btn { min-height: 36px; }
.dl-log-btns .btn.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.dl-logform { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

/* details */
.dl-grid .input, .dl-grid .select { min-height: 36px; }
.dl-profit { display: flex; align-items: center; min-height: 36px; font-weight: 650; font-size: 15px; }
.dl-saved { font-weight: 560; }
.dl-msg { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }

/* checklist */
.dl-bar { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-bottom: 6px; }
.dl-bar span { display: block; height: 100%; background: var(--good); transition: width .2s; }
.dl-checklist { list-style: none; margin: 0 0 8px; padding: 0; }
.dl-checklist li { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line-soft); }
.dl-checklist li.is-done .dl-ck-label { color: var(--muted); text-decoration: line-through; }
.dl-del { color: var(--faint); min-width: 36px; min-height: 36px; justify-content: center; }
.dl-del:hover { color: var(--bad); }
.dl-inline { display: flex; gap: 8px; margin-top: 4px; }
.dl-inline .input { min-height: 36px; }

/* invoices */
.dl-invs { list-style: none; margin: 0 0 8px; padding: 0; }
.dl-inv { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.dl-inv-when { font-size: 12.5px; }
.dl-inv-amt { font-weight: 650; }

/* where the lead came from */
.dl-kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 6px 14px; margin: 0; align-items: center; }
.dl-kv dt { color: var(--muted); font-size: 13px; }
.dl-kv dd { margin: 0; min-width: 0; }
.dl-break { overflow-wrap: anywhere; }
.dl-idrow { display: flex; align-items: center; gap: 6px; }
.dl-idrow code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; min-width: 0; flex: 1; }
.dl-flags { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.dl-flags .dl-checkbtn { flex: none; }

/* history */
.dl-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.dl-ev { display: flex; gap: 10px; padding: 8px 0; position: relative; }
.dl-ev + .dl-ev { border-top: 1px solid var(--line-soft); }
.dl-ev-icon { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.dl-ev-icon svg { width: 14px; height: 14px; }
.dl-ev-icon.dl-ev-payment { background: var(--good-bg); color: var(--good); }
.dl-ev-icon.dl-ev-stage { background: var(--info-bg); color: var(--info); }
.dl-ev-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.dl-ev-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 1px; }

/* lost reasons modal */
.dl-reasons { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.dl-reason { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-ctl); cursor: pointer; }
.dl-reason:has(input:checked) { border-color: var(--text); background: var(--surface-2); font-weight: 560; }
.dl-reason input { margin: 0; }

.dl-danger { display: flex; justify-content: center; padding-top: 8px; }

/* deals table: star column, urgent label */
.pl-tbl .pl-tbl-starcol { width: 44px; padding: 0 0 0 4px; }
.pl-tbl-starcol .pl-star { margin: 0; }
.pl-tbl-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pl-tbl-name .pl-tbl-open { min-width: 0; }
.pl-tbl-filters .pl-flags { flex: none; }

/* drawer head: star and urgent */
.dl-star { min-width: 36px; min-height: 36px; justify-content: center; color: var(--faint); flex: none; }
.dl-star svg { width: 18px; height: 18px; }
.dl-star:hover { color: var(--text); }
.dl-star.on { color: var(--text); }
.dl-urgent { min-height: 36px; color: var(--muted); flex: none; }
.dl-urgent svg { width: 14px; height: 14px; }
.dl-urgent.on { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); color: var(--bad); }

/* contact facts and agent representation form */
.dl-cfacts { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.dl-addr-view { white-space: pre-line; overflow-wrap: anywhere; }
.dl-addr { min-height: 72px; }
.dl-agent { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; }
.dl-agent-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dl-agent-top .btn { min-height: 36px; }
.dl-agent-top .chip svg { width: 12px; height: 12px; }
.dl-agent .dl-label { margin-bottom: 3px; }
.dl-files-agent { margin: 0; }

/* order */
.dl-order.is-closed .dl-sec-head { margin-bottom: 4px; }
.dl-order-why { margin-bottom: 10px; }
.dl-charges { display: flex; width: 100%; }
.dl-charges button { flex: 1; min-height: 32px; white-space: nowrap; }

/* files */
.dl-files { list-style: none; margin: 0 0 10px; padding: 0; }
.dl-file { display: flex; align-items: center; gap: 4px; min-height: 48px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.dl-file-main { min-width: 0; padding-right: 6px; }
.dl-file-name { display: block; max-width: 100%; font-weight: 600; color: var(--text); text-decoration: none; }
.dl-file-name:hover { text-decoration: underline; }
.dl-file-meta { font-size: 12.5px; }
.dl-file-btn { min-height: 36px; min-width: 36px; justify-content: center; text-decoration: none; color: var(--muted); }
.dl-file-btn:hover { color: var(--text); }
.dl-drop { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px; border: 1.5px dashed var(--line); border-radius: 8px; background: var(--surface-2); transition: border-color .12s, background-color .12s; }
.dl-drop.is-over { border-color: var(--focus); background: color-mix(in srgb, var(--focus) 9%, var(--surface-2)); }
.dl-drop .dl-hint { flex: 1; min-width: 180px; }
.dl-uploads { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dl-upload { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.dl-upload > svg { width: 16px; height: 16px; flex: none; }
.dl-upload-msg { color: var(--muted); }
.dl-upload.is-error { background: var(--bad-bg); color: var(--bad); }
.dl-upload.is-error .dl-upload-msg { color: var(--bad); }
.dl-upload .grow { min-width: 0; }
.dl-spin { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--focus); animation: dl-spin .8s linear infinite; }
@keyframes dl-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .dl-spin { animation: none; border-top-color: var(--line); border-style: dotted; } }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .pl-head .pl-tools { margin-left: 0; width: 100%; }
  .pl-search { flex: 1 1 100%; min-width: 140px; width: auto; }
  .pl-new { flex: 1 1 auto; justify-content: center; }
  .pl-nav { display: none; }
  .pl-tabs { display: flex; align-items: center; gap: 6px; overflow-x: auto; margin: 0 -14px 12px; padding: 2px 14px; scrollbar-width: none; }
  .pl-tabs::-webkit-scrollbar { display: none; }
  .pl-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 560; cursor: pointer; }
  .pl-tab.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
  .pl-tab-n { font-size: 12px; min-width: 20px; text-align: center; padding: 0 5px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
  .pl-tab.on .pl-tab-n { background: color-mix(in srgb, var(--surface) 22%, transparent); color: var(--surface); }
  .pl-board { display: block; overflow: visible; height: auto; min-height: 0; padding-bottom: 0; }
  .pl-col { display: none; min-height: 0; background: none; border: 0; }
  .pl-col.is-tab { display: flex; }
  .pl-col-head { padding: 0 2px 8px; }
  .pl-cards { padding: 0; gap: 12px; overflow: visible; }
  .pl-card { padding: 12px 14px 8px; cursor: pointer; }
  .pl-card.is-urgent { padding-left: 11px; }
  .pl-card-foot { display: flex; justify-content: flex-end; margin: 0 -6px 0 0; }
  .pl-more { display: none; }
  .pl-star { margin-right: -8px; }

  .pl-tbl-search { max-width: none; flex-basis: 100%; }
  .pl-tbl-sel { flex: 1; max-width: none; }
  .pl-only-mobile { display: block; font-size: 12.5px; }
  .pl-tbl td, .pl-tbl .pl-sort { padding-left: 10px; padding-right: 10px; }

  .dl-sec { padding: 12px 14px; }
  .dl-drawer .dl-head { gap: 6px; padding-left: 12px; padding-right: 10px; }
  .dl-charges button { min-height: 36px; padding-left: 6px; padding-right: 6px; }
  .dl-file { flex-wrap: wrap; }
  .dl-file-main { flex-basis: 100%; }
  .pl-tbl .pl-tbl-starcol { width: 40px; padding-left: 0; }
  .dl-reasons { grid-template-columns: 1fr; }
  .dl-kv { grid-template-columns: 1fr; gap: 2px; }
  .dl-kv dd { margin-bottom: 6px; }
}

/* simpler card (05/11/2026): invoice inside the quote, "Came from" and History fold away */
.dl-qinv { margin-top: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.dl-qinv .dl-invs { align-self: stretch; }
.dl-src summary, .dl-hist summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; min-height: 28px; }
.dl-src summary::-webkit-details-marker, .dl-hist summary::-webkit-details-marker { display: none; }
.dl-src summary h3, .dl-hist summary h3 { margin: 0; }
.dl-src summary::after, .dl-hist summary::after { content: ''; width: 7px; height: 7px; border-right: 1.8px solid var(--muted); border-bottom: 1.8px solid var(--muted); transform: rotate(45deg); margin: -3px 2px 0 6px; flex: none; }
.dl-src details[open] summary::after, .dl-hist details[open] summary::after { transform: rotate(-135deg); margin-top: 3px; }
.dl-src details[open] summary, .dl-hist details[open] summary { margin-bottom: 12px; }
.dl-src-more { font-size: 13px; }

/* quote with items, and the representation form box (green once signed) */
.dl-qitems { display: grid; gap: 8px; }
.dl-qhead, .dl-qrow { display: grid; grid-template-columns: minmax(0, 1fr) 104px 34px; gap: 8px; align-items: center; }
.dl-qhead { font-size: 12.5px; color: var(--muted); font-weight: 540; }
.dl-qamt { text-align: right; }
.dl-qfoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.dl-qtotal { font-size: 14px; color: var(--muted); }
.dl-qtotal b { font-size: 17px; color: var(--text); margin-left: 6px; }
.dl-rep .dl-sec-head .chip { margin-left: auto; }
.dl-rep-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.dl-rep.is-sent { border-color: color-mix(in srgb, var(--warn, #b7791f) 45%, var(--line)); }
.dl-rep.is-signed { border-color: color-mix(in srgb, var(--good, #2f8f5b) 60%, var(--line)); background: var(--good-bg); }

/* card tabs (Lead/Customer | Documents) and the services dropdown in the quote */
.dl-tabs { align-self: flex-start; }
.dl-tab-n { margin-left: 4px; font-size: 12px; color: var(--muted); }
.dl-qname { position: relative; min-width: 0; }
.dl-qname .input { width: 100%; padding-right: 38px; }
.dl-qpick { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.dl-qpick svg { width: 16px; height: 16px; transform: rotate(90deg); }
.dl-qpick:hover, .dl-qpick:focus-visible { background: var(--surface-2); color: var(--text); }
.menu .dl-mn-name { flex: 1; min-width: 0; text-align: left; }
.menu .dl-mn-price { margin-left: 18px; color: var(--muted); }
.menu button:has(.dl-mn-name) { display: flex; align-items: center; min-width: 240px; }
.dl-doc-invs { margin-top: 10px; }

/* paid and signed show green: Customers board signs and the Import charges box */
.pl-sign.is-ok { color: var(--good); }
.pl-paid { padding: 2px 8px; min-height: 26px; font-size: 12.5px; }
.dl-order.is-paid { border-color: color-mix(in srgb, var(--good) 60%, var(--line)); background: var(--good-bg); }

/* Documents: button in the card header, rows by kind of document, Docs link on the Customers board */
.dl-docbtn.on { background: var(--surface-2); }
.dl-doctypes { display: grid; gap: 8px; }
.dl-doctype { border: 1px solid var(--line-soft); border-radius: 10px; padding: 8px 10px; }
.dl-doctype.has { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.dl-doctype.is-over { border-color: var(--focus); background: var(--surface-2); }
.dl-doctype-head { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.dl-doctype-name { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.dl-doctype-ok { width: 15px; height: 15px; color: var(--good); }
.dl-doctype .dl-files, .dl-doctype .dl-invs { margin-top: 6px; }
.pl-docs { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; font-size: 12.5px; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.pl-docs:hover { color: var(--text); }

/* Customers board (Greg, 05/11/2026): the services to do, in order; a starred order stands out in yellow, apart from the orange Urgent */
.pl-svcs { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; counter-reset: svc; }
.pl-svcs li { counter-increment: svc; font-size: 13px; color: var(--text); display: block; }
.pl-svcs li::before { content: counter(svc); display: inline-grid; place-items: center; width: 17px; height: 17px; margin-right: 7px; border-radius: 50%; font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--surface-2); vertical-align: 1px; }
.pl-star.on, .dl-star.on, .pl-flag.on .pl-star-ic { color: #e6b400; }
.pl-star.on svg, .dl-star.on svg { stroke: #a37f00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pl-star.on, :root:not([data-theme="light"]) .dl-star.on { color: #f7cf3d; } }
:root[data-theme="dark"] .pl-star.on, :root[data-theme="dark"] .dl-star.on { color: #f7cf3d; }

/* Requests to partners (NOVA, mark as arrived) in the customer card */
.dl-req-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dl-req { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 10px; }
.dl-req-what { font-size: 12.5px; }

/* card header: Lead/Customer and Documents as two tabs side by side */
.dl-views button { display: inline-flex; align-items: center; gap: 6px; }
.dl-rep-wait { color: var(--text); font-weight: 560; }

/* customer card: services list */
.dl-svcs li { font-size: 14px; }

.dl-req-pick { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 50vh; overflow: auto; }
.dl-req-pick label { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 8px; cursor: pointer; }
.dl-req-pick .clip { min-width: 0; }

/* Quick look: preview of a file inside the CRM */
.ql-scrim { z-index: 80; }
.ql { position: fixed; z-index: 81; inset: 3vh 3vw; display: flex; flex-direction: column; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-pop); overflow: hidden; }
.ql-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line-soft); }
.ql-title { display: flex; flex-direction: column; min-width: 0; }
.ql-title .muted { font-size: 12.5px; }
.ql-prev svg { transform: rotate(180deg); }
.ql-body { flex: 1; min-height: 0; display: grid; place-items: center; background: var(--surface-2); }
.ql-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.ql-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ql-none { text-align: center; padding: 24px; }
.dl-file-name { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--line); max-width: 100%; }
.dl-file-name:hover { text-decoration-color: currentColor; }
@media (max-width: 640px) { .ql { inset: 0; border-radius: 0; } }
.ql-head a.btn, .ql-none a.btn { text-decoration: none; }
.dl-svc-paid { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 14px; }
.dl-svcs li { display: flex; align-items: center; gap: 8px; }
.dl-svcs li::before { flex: none; margin-right: 0; }
.dl-svcs li .num { font-variant-numeric: tabular-nums; }
.dl-svc-paid { align-items: center; font-weight: 600; }

/* PDF editor: pages at 100%, text in Roboto (the V55 font), white cover boxes */
.pe-head { flex-wrap: wrap; }
.pe-size .select { height: 32px; padding: 0 8px; }
.pe-hint { margin: 0; padding: 6px 16px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line-soft); }
.pe-pages { flex: 1; min-height: 0; overflow: auto; background: var(--surface-2); padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.pe-page { position: relative; flex: none; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: text; touch-action: none; }
.pe-pages[data-mode="rect"] .pe-page { cursor: crosshair; }
.pe-page canvas { display: block; }
.pe-item { position: absolute; }
.pe-text { display: flex; align-items: flex-start; }
.pe-tx { font-family: 'PdfEditRoboto', Roboto, sans-serif; font-size: inherit; line-height: 1.2; color: #000; white-space: pre; min-width: 6px; outline: 1px dashed transparent; padding: 0; caret-color: #000; }
.pe-text.is-sel .pe-tx, .pe-tx:focus { outline-color: #2b6cb0; }
.pe-grip { position: absolute; left: -14px; top: 0; width: 10px; height: 1.2em; cursor: move; opacity: 0; background-image: radial-gradient(#2b6cb0 1.2px, transparent 1.3px); background-size: 5px 5px; }
.pe-text:hover .pe-grip, .pe-text.is-sel .pe-grip { opacity: 1; }
.pe-rect { background: #fff; cursor: move; outline: 1px dashed #9aa5b1; }
.pe-rect.is-sel { outline: 1.5px solid #2b6cb0; }

/* Next step and Notes side by side (Notes: Greg, 07/11/2026); one under the other on narrow screens */
.dl-next-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.dl-next-row > .card { margin: 0; }
.dl-notes { display: flex; flex-direction: column; }
.dl-notes-text { flex: 1; min-height: 120px; resize: vertical; font: inherit; }
@media (max-width: 900px) { .dl-next-row { grid-template-columns: minmax(0, 1fr); } }

/* Quick look: photos fit the window whole, zoom and drag (Greg, 07/11/2026) */
.ql-body { position: relative; overflow: hidden; display: block; }
.ql-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; }
.ql-stage .ql-img { position: absolute; left: 50%; top: 50%; max-width: none; max-height: none; transform-origin: center center; }
.ql-stage.is-zoomed { cursor: grab; }
.ql-stage.is-dragging { cursor: grabbing; }
.ql-pdfstage { overflow: auto; cursor: grab; }
.ql-pdfstage.is-dragging { cursor: grabbing; }
.ql-pages { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px; min-width: min-content; }
.ql-page { display: block; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.ql-loading { padding: 40px; text-align: center; }
.ql-zoom { display: inline-flex; align-items: center; gap: 2px; margin-right: 6px; }
.ql-zoom .btn-icon { font-size: 18px; font-weight: 600; line-height: 1; }
.ql-zlabel { min-width: 58px; justify-content: center; }
.ql-frame { position: absolute; inset: 0; }
.ql-none { position: absolute; inset: 0; display: grid; place-content: center; }
/* under the quote: Create invoice and Send representation form side by side (Greg, 12/11/2026) */
.dl-qbtns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ni-from { margin: 0 0 8px; }
.ni-meta { margin-top: 12px; }
/* Requests follow the order's step (Greg, 12/11/2026): the current step's button is the red one, the others are greyed */
.dl-req-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.dl-req.is-off b, .dl-req.is-off .dl-req-what { color: var(--text-3, #8a8f98); }
.dl-req.is-now { border-color: var(--accent, #9d0208); }
.dl-req .btn[disabled] { opacity: .45; cursor: not-allowed; }

/* same person twice (Greg, 13/11/2026) */
.dl-dupes { border-color: var(--warn, #b7791f); }
.dl-dupwarn { grid-column: 1 / -1; display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--warn, #b7791f); border-radius: 8px; background: color-mix(in srgb, var(--warn, #b7791f) 10%, transparent); }
.dl-dupwarn-row { display: flex; align-items: center; gap: 8px; }
.db-taxlist { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.db-taxlist li { display: flex; align-items: center; gap: 8px; }
.db-taxlist li b { margin-left: auto; }
.st-bk table td, .st-bk table th { vertical-align: middle; }
