/* WetEdge styles. Rule order matters (later rules win), so sections follow the original order. */

/* ===== Colors and sizes (light theme; the dark theme follows) ===== */
:root {
  --bg: #f3f6f8;
  --panel: #ffffff;
  --panel2: #f8fafb;
  --ink: #13232e;
  --muted: #5d6d79;
  --line: #dbe3e9;
  --brand: #0a6a84;
  --brand-2: #0e8aa8;
  --brand-soft: #e2f1f5;
  --on-brand: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #a15c07;
  --warn-soft: #fef4e6;
  --ok: #067647;
  --ok-soft: #e7f6ee;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.05),0 1px 3px rgba(16,24,40,.08);
}

/* Dark theme: used when the device is in dark mode (Theme: Automatic) or when the person picks Dark.
   Picking Light keeps the light colors even on a dark device. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f171d;
    --panel: #16222a;
    --panel2: #1b2933;
    --ink: #e4edf2;
    --muted: #9db0bd;
    --line: #2a3b46;
    --brand: #3fb3cf;
    --brand-2: #5cc4dc;
    --brand-soft: #173540;
    --on-brand: #06202a;
    --danger: #f97066;
    --danger-soft: #3a1a18;
    --warn: #fdb022;
    --warn-soft: #3a2a10;
    --ok: #47cd89;
    --ok-soft: #123224;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f171d;
  --panel: #16222a;
  --panel2: #1b2933;
  --ink: #e4edf2;
  --muted: #9db0bd;
  --line: #2a3b46;
  --brand: #3fb3cf;
  --brand-2: #5cc4dc;
  --brand-soft: #173540;
  --on-brand: #06202a;
  --danger: #f97066;
  --danger-soft: #3a1a18;
  --warn: #fdb022;
  --warn-soft: #3a2a10;
  --ok: #47cd89;
  --ok-soft: #123224;
  color-scheme: dark;
}
:root[data-theme="light"] {
  color-scheme: light;
}

/* ===== Base elements ===== */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
}

body {
  font: 14px/1.45 "Segoe UI",system-ui,-apple-system,Roboto,Arial,sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* ===== Page layout: header, left menu, main area ===== */
.app {
  display: grid;
  grid-template-columns: 210px minmax(0,1fr);
  grid-template-rows: 58px 1fr;
  min-height: 100vh;
}

header {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .2px;
}

.brand small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0;
}

.hdr-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.co {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
/* only the name is shortened with "…"; the logo is never clipped (so its glow shows in dark themes) */
.co span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.co img {
  height: 26px;
  width: auto;
  border-radius: 4px;
}

.viewas {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.viewas select {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
}

nav {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
}

nav button:hover {
  background: var(--panel2);
  color: var(--ink);
}

nav button.on {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

nav svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.themepick {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.themepick select {
  font-size: 11px;
  padding: 2px 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}
.navnote {
  margin-top: auto;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

main {
  padding: 22px;
  min-width: 0;
}

h1 {
  font-size: 22px;
  margin: 0;
}

h2 {
  font-size: 15px;
  margin: 0 0 12px;
}

h3 {
  font-size: 13px;
  margin: 16px 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.pagehead {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pagehead .sub {
  color: var(--muted);
  font-size: 13px;
}

.pagehead .actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Cards, buttons and tables ===== */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.btn:hover {
  background: var(--panel2);
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

.btn.primary:hover {
  background: var(--brand-2);
}

.btn.danger {
  color: var(--danger);
}

.btn.sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn.icon {
  padding: 5px 8px;
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.search {
  flex: 1 1 240px;
  min-width: 180px;
  position: relative;
}

.search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
}

select.f {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}

th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  background: var(--panel2);
  position: sticky;
  top: 0;
}

th.sort {
  cursor: pointer;
  user-select: none;
}

th.sort:hover {
  color: var(--ink);
}

tbody tr.click {
  cursor: pointer;
}

tbody tr.click:hover td {
  background: var(--brand-soft);
}

tr:last-child td {
  border-bottom: 0;
}

td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td.wrap {
  white-space: normal;
  min-width: 240px;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

/* ===== Status chips (Lead, Active, Sold…) ===== */
.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--panel2);
  color: var(--muted);
  border: 1px solid var(--line);
}

.chip.Lead {
  background: #eef4ff;
  color: #3538cd;
  border-color: #c7d7fe;
}

.chip.Active {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: transparent;
}

.chip.Hold {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: transparent;
}

.chip.Sold {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: transparent;
}

.chip.Complete {
  background: #f0f9ff;
  color: #026aa2;
  border-color: #b9e6fe;
}

.chip.Lost, .chip.Cnx {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

.chip.arch {
  background: var(--panel2);
  color: var(--muted);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip.Lead {
    background: #1d2450;
    color: #a4bcfd;
    border-color: transparent;
  }
  :root:not([data-theme="light"]) .chip.Complete {
    background: #0b2a3a;
    color: #7cd4fd;
    border-color: transparent;
  }
}
:root[data-theme="dark"] .chip.Lead {
  background: #1d2450;
  color: #a4bcfd;
  border-color: transparent;
}
:root[data-theme="dark"] .chip.Complete {
  background: #0b2a3a;
  color: #7cd4fd;
  border-color: transparent;
}

.detail {
  display: grid;
  grid-template-columns: minmax(0,1.6fr) minmax(280px,1fr);
  gap: 16px;
  align-items: start;
}

/* ===== Forms and fields ===== */
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 10px 14px;
}

.form.three {
  grid-template-columns: repeat(3,minmax(0,1fr));
}

.form .full {
  grid-column: 1/-1;
}

.fld label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.fld input, .fld select, .fld textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.fld textarea {
  min-height: 76px;
  resize: vertical;
}

.fld input:focus, .fld select:focus, .fld textarea:focus, td input:focus, td select:focus {
  outline: 2px solid var(--brand-2);
  outline-offset: -1px;
  border-color: transparent;
}

.fld input[readonly] {
  background: var(--panel2);
  color: var(--muted);
}

.fld select:disabled {
  background: var(--panel2);
  color: var(--muted);
  cursor: not-allowed;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.dn {
  font-size: 20px;
  font-weight: 700;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin: -4px 0 14px;
  overflow-x: auto;
}

.tabs button {
  padding: 9px 12px;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tabs button.on {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

td input, td select {
  width: 100%;
  min-width: 60px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

td input.n {
  text-align: right;
  width: 90px;
}

td select {
  min-width: 120px;
}

td input.w {
  min-width: 280px;
}

.phase {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.phase .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.phase .row b {
  color: var(--ink);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 10px;
  display: flex;
  gap: 14px;
  align-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  z-index: 20;
  font-size: 13px;
}

.toast button {
  background: none;
  border: 0;
  color: var(--brand-2);
  font-weight: 700;
  cursor: pointer;
}

/* ===== Sign-in and setup screens ===== */
.authcard {
  max-width: 420px;
  margin: 40px auto;
}

.authform {
  display: grid;
  gap: 12px;
}

.authform label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.authform input {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink,inherit);
  font-size: 15px;
}

.btncap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  vertical-align: top;
}

.btncap>span {
  font-size: 11px;
  line-height: 1.25;
  color: var(--muted);
  max-width: 150px;
  text-align: center;
}

.actions:has(.btncap) {
  align-items: flex-start;
}

.listcards {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(280px,1fr));
  gap: 14px;
}

.listcards .card.wide {
  grid-column: 1/-1;
  order: -1;
}

.lrow textarea {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font: inherit;
  resize: vertical;
  line-height: 1.4;
}

.lrow {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.lrow input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.lock {
  font-size: 11px;
  color: var(--warn);
  font-weight: 600;
}

.total {
  font-weight: 700;
}

.total.bad {
  color: var(--danger);
}

.total.good {
  color: var(--ok);
}

/* ===== Printed documents: proposal, ATC, statements ===== */
.doc {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  color: #1a1a1a;
  font-family: Arial,Helvetica,sans-serif;
}

.doc .dhead {
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 2px solid #1a1a1a;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.doc .dhead img {
  height: 44px;
}

.doc .dname {
  font-size: 20px;
  font-weight: 700;
  color: #0a4f87;
}

.doc .daddr {
  font-size: 11px;
  color: #444;
  font-family: Arial,sans-serif;
}

.doc h4 {
  margin: 6px 0;
  font-family: Arial,sans-serif;
  font-size: 13px;
  letter-spacing: .5px;
}

.doc p {
  font-size: 12px;
  font-style: italic;
  line-height: 1.5;
  margin: 0;
}

.doc .sig {
  display: flex;
  gap: 24px;
  margin-top: 26px;
  font-family: Arial,sans-serif;
  font-size: 11px;
  color: #444;
}

.doc .sig div {
  flex: 1;
  border-top: 1px solid #888;
  padding-top: 4px;
  text-align: center;
}

.logobox {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.logobox .slot {
  flex: 1 1 200px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.logobox img {
  max-height: 70px;
  max-width: 100%;
  display: block;
  margin: 0 auto 8px;
}

/* ===== Notices and hints ===== */
.notice {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 14px;
}

.notice.warn {
  background: var(--warn-soft);
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 13px;
}

.kv span:nth-child(odd) {
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.right {
  text-align: right;
}

/* ===== Estimate worksheet and totals ===== */
.ws {
  display: grid;
  grid-template-columns: minmax(0,1fr) 290px;
  gap: 16px;
  align-items: start;
}

.ws-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.ws-side {
  position: sticky;
  top: 74px;
}

table.mini {
  width: 100%;
}

table.mini td {
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  white-space: normal;
  font-size: 13px;
  background: none;
}

table.mini td.num {
  padding-left: 10px;
  white-space: nowrap;
}

table.mini tr.tot td {
  font-weight: 700;
  font-size: 16px;
  border-bottom: 0;
  padding-top: 10px;
}

.lines {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.readout {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.readout b {
  color: var(--ink);
}

tr.onrow td {
  background: var(--brand-soft);
}

select.st {
  min-width: 110px;
}

.prow {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
}

.prow:hover {
  background: var(--brand-soft);
}

.prow span {
  color: var(--muted);
  font-size: 13px;
}

.prow span.num {
  margin-left: auto;
  color: var(--ink);
  font-weight: 600;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.seg button {
  border: 0;
  background: var(--panel);
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.seg button.on {
  background: var(--brand);
  color: var(--on-brand);
}

.doc.proposal {
  max-width: 860px;
  margin: 0 auto;
}

.kvbox {
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}

.kvbox b {
  color: var(--ink);
}

.doc.comm input, .doc.comm select {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #1a1a1a;
  font: inherit;
}

.doc.comm input.n {
  width: 100px;
  text-align: right;
}

.printonly {
  display: none;
}

.attach {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  font-weight: 600;
  font-size: 13px;
}

.doc {
  color-scheme: light;
}

.doc .btn {
  background: #fff;
  color: #1a1a1a;
  border-color: #c9c9c9;
}

.doc .btn:hover {
  background: #f2f2f2;
}

.card.ck>h2.ckh {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card.ck>h2.ckh .ckc {
  display: inline-block;
  width: 14px;
  color: var(--muted,#888);
  font-size: 12px;
}

.card.ck.collapsed>*:not(h2) {
  display: none!important;
}

.card.ck.collapsed>h2 {
  margin-bottom: 0;
}

.ckbar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 8px;
}

.doc .btn.lopt {
  padding: 1px 7px;
  font-size: 11px;
  margin-left: 6px;
  vertical-align: 1px;
}

.doc .fld label {
  color: #555;
}

.doc .fld input, .doc .fld select, .doc .fld textarea {
  background: #fff;
  color: #1a1a1a;
  border-color: #c9c9c9;
}

.doc .fld textarea::placeholder, .doc input::placeholder {
  color: #888;
}

.doc .muted {
  color: #666;
}

.doc .btn, .doc .fld textarea, .doc .fld input, .doc .fld select, .doc.comm input, .doc.comm select {
  font-family: "Segoe UI",system-ui,Arial,sans-serif;
}

.pbody td input:not(.n):not(.w) {
  min-width: 150px;
}

/* compact price tables: no sideways scrolling */
.pbody .tablewrap {
  overflow-x: visible;
}

/* ===== Price list ===== */
.pbody table {
  width: 100%;
  table-layout: fixed;
}

.pbody th, .pbody td {
  padding: 6px 5px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.pbody th {
  white-space: normal;
  line-height: 1.2;
}

.pbody td input, .pbody td select, .pbody td input.w, .pbody td input.n, .pbody td input:not(.n):not(.w) {
  width: 100%;
  min-width: 0;
  max-width: none;
  padding: 5px 6px;
  font-size: 13px;
}

.pbody th.num {
  width: 74px;
}

.pbody th.catc {
  width: 110px;
}

.pbody th.actc {
  width: 66px;
}

.pbody th.wc {
  width: 24%;
}

/* Options – pick list: narrow Default price and Category, the item text gets the rest */
.pbody table.pt-options2 th.wc {
  width: auto;
}
.pbody table.pt-options2 th.num {
  width: 90px;
}
.pbody table.pt-options2 th.catc {
  width: 120px;
}

/* Plumbing: narrow Unit column, wider Proposal wording */
.pbody table.pt-plumbing th.col-unit {
  width: 64px;
}
.pbody table.pt-plumbing th.wc {
  width: 30%;
}

.pbody td .btn.icon {
  padding: 3px 6px;
}

@media (max-width:1180px) {
  .pbody .detail {
    grid-template-columns: minmax(0,1fr);
  }
}

.plist {
  display: grid;
  grid-template-columns: 200px minmax(0,1fr);
  gap: 20px;
  align-items: start;
}

.pnav {
  position: sticky;
  top: 74px;
  max-height: calc(100vh - 92px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow);
}

.pnav .pg {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 10px 4px;
}

.pnav .pg:first-child {
  padding-top: 4px;
}

.pnav button.pg {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  font-weight: 700;
  padding: 9px 10px;
  border-radius: 6px;
}

.pnav button.pg.open {
  color: var(--ink);
}

.pnav .pg .chev {
  width: 10px;
  font-size: 10px;
}

.pnav button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
}

.pnav button:hover {
  background: var(--panel2);
}

.pnav button.on {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.pnav-sel {
  display: none;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

@media (max-width:1280px) {
  .plist {
    grid-template-columns: minmax(0,1fr);
  }
  .pnav {
    position: static;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: none;
  }
  .pnav-list {
    display: none;
  }
  .pnav-sel {
    display: block;
  }
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width:820px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
}

.qtable td {
  white-space: normal;
}

textarea[data-f="notes"][data-bind^="pl:"] {
  min-height: 150px;
}

.qtable input[type=checkbox] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.tkgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(170px,1fr));
  gap: 10px;
  margin-bottom: 10px;
}

/* ===== Takeoff ===== */
.tk {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel2);
}

.tkl {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.tkv {
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
}

textarea[data-bind="mail"] {
  min-height: 260px;
}

.doc h4 {
  margin: 16px 0 4px;
}

.doc .dmeta {
  text-align: right;
  font-family: Arial,sans-serif;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
}

.doc .dcols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  font-family: Arial,sans-serif;
  font-size: 12.5px;
  margin: 10px 0 12px;
  line-height: 1.5;
}

.doc .dcols.one {
  grid-template-columns: 1fr;
}

.doc .dcols.one>div.downer:last-child {
  text-align: left;
}

.doc .dcols.three {
  grid-template-columns: repeat(3,1fr);
}

.doc .dcols>div:last-child:not(.kvd) {
  text-align: right;
}

.doc .dlabel {
  font-size: 10px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 3px;
}

.doc .dsmall {
  font-size: 11px;
  color: #555;
}

.doc .dfine {
  font-size: 11px;
  font-style: italic;
  color: #333;
  margin: 8px 0;
}

.doc .dnotes {
  font-size: 12px;
  font-style: normal;
}

.doc table.dtable {
  width: 100%;
  border-collapse: collapse;
  font-family: Arial,sans-serif;
  font-size: 12px;
  margin-bottom: 4px;
}

.doc table.dtable td, .doc table.dtable th {
  padding: 4px 6px;
  border-bottom: 1px solid #e3e3e3;
  color: #1a1a1a;
  white-space: normal;
  background: #fff;
  position: static;
}

.doc table.dtable th {
  font-size: 11px;
  color: #555;
  background: #f3f3f3;
}

.doc table.dtable td.num {
  white-space: nowrap;
  width: 110px;
}

.doc table.dtable tr.sub td {
  font-weight: 700;
  border-bottom: 1px solid #999;
}

.doc table.dtable.grand {
  margin-top: 14px;
}

.doc table.dtable.grand td {
  font-size: 15px;
  font-weight: 700;
  border-top: 2px solid #1a1a1a;
  border-bottom: 2px solid #1a1a1a;
}

.doc .kvd {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
}

.doc .kvd span:nth-child(odd) {
  color: #666;
}

.doc .draftmark {
  background: #fff4d6;
  color: #8a5a00;
  font-family: Arial,sans-serif;
  font-weight: 700;
  text-align: center;
  padding: 5px;
  margin: -6px 0 12px;
  border-radius: 4px;
  font-size: 12px;
}

/* ===== Smaller screens and printing ===== */
@media (max-width:1000px) {
  .detail {
    grid-template-columns: minmax(0, 1fr);
  }
  .ws {
    grid-template-columns: minmax(0, 1fr);
  }
  .ws-side {
    position: static;
    order: -1;
  }
}

@media (max-width:620px) {
  .doc .dcols, .doc .dcols.three {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media print {
  :root {
    color-scheme: light;
  }
  .printonly {
    display: block;
  }
  .doc.comm input, .doc.comm select {
    border: 0;
    padding: 0;
    appearance: none;
  }
  header, nav, .noprint, #toast {
    display: none!important;
  }
  .app {
    display: block;
  }
  main {
    padding: 0;
  }
  body {
    background: #fff;
  }
  .doc {
    border: 0;
    padding: 0;
  }
  .doc.proposal {
    max-width: none;
  }
}

@media (max-width:820px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
  }
  header {
    flex-wrap: wrap;
    padding: 8px 16px;
    gap: 8px;
    position: static;
  }
  .hdr-right {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }
  nav {
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 6px 10px;
  }
  nav button {
    width: auto;
    white-space: nowrap;
  }
  .navnote {
    display: none;
  }
  main {
    padding: 16px;
  }
  .form, .form.three {
    grid-template-columns: minmax(0, 1fr);
  }
  .co {
    min-width: 0;
    flex: 1 1 auto;
    justify-content: center;
  }
  .co span {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ===== Color accents ===== */
/* One color per category, used for estimate cards and the estimate total; lighter shades in dark mode. */
:root {
  --c-pool: #1570cd;
  --c-spa: #0e8a7e;
  --c-tile: #6941c6;
  --c-interior: #c11574;
  --c-equipment: #c4560b;
  --c-plumbing: #0086c9;
  --c-water: #088ab2;
  --c-deck: #a15c07;
  --c-demo: #6b6157;
  --c-elec: #b08a00;
  --c-screen: #138a4b;
  --c-nav-leads: #1570cd;
  --c-nav-plans: #0e8a7e;
  --c-nav-atcs: #6941c6;
  --c-nav-comms: #138a4b;
  --c-nav-builders: #a15c07;
  --c-nav-prices: #c11574;
  --c-nav-settings: #5d6d79;
  --c-nav-companies: #3538cd;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-pool: #53b1fd;
    --c-spa: #2ed3b7;
    --c-tile: #a48afb;
    --c-interior: #f670c7;
    --c-equipment: #fd853a;
    --c-plumbing: #36bffa;
    --c-water: #22ccee;
    --c-deck: #fdb022;
    --c-demo: #b9ada1;
    --c-elec: #fac515;
    --c-screen: #47cd89;
    --c-nav-leads: #53b1fd;
    --c-nav-plans: #2ed3b7;
    --c-nav-atcs: #a48afb;
    --c-nav-comms: #47cd89;
    --c-nav-builders: #fdb022;
    --c-nav-prices: #f670c7;
    --c-nav-settings: #9db0bd;
    --c-nav-companies: #8098f9;
  }
}
:root[data-theme="dark"] {
  --c-pool: #53b1fd;
  --c-spa: #2ed3b7;
  --c-tile: #a48afb;
  --c-interior: #f670c7;
  --c-equipment: #fd853a;
  --c-plumbing: #36bffa;
  --c-water: #22ccee;
  --c-deck: #fdb022;
  --c-demo: #b9ada1;
  --c-elec: #fac515;
  --c-screen: #47cd89;
  --c-nav-leads: #53b1fd;
  --c-nav-plans: #2ed3b7;
  --c-nav-atcs: #a48afb;
  --c-nav-comms: #47cd89;
  --c-nav-builders: #fdb022;
  --c-nav-prices: #f670c7;
  --c-nav-settings: #9db0bd;
  --c-nav-companies: #8098f9;
}
.cat-pool { --cc: var(--c-pool); }
.cat-spa { --cc: var(--c-spa); }
.cat-tile { --cc: var(--c-tile); }
.cat-interior { --cc: var(--c-interior); }
.cat-equipment { --cc: var(--c-equipment); }
.cat-plumbing { --cc: var(--c-plumbing); }
.cat-water { --cc: var(--c-water); }
.cat-deck { --cc: var(--c-deck); }
.cat-demo { --cc: var(--c-demo); }
.cat-elec { --cc: var(--c-elec); }
.cat-screen { --cc: var(--c-screen); }

/* Estimate cards: color stripe on the left, title in the category color */
.card.ck[class*="cat-"] {
  border-left: 4px solid var(--cc);
}
.card.ck[class*="cat-"] > h2.ckh {
  color: var(--cc);
}

/* Estimate total: a color dot per category, $0 rows dimmed, stronger grand total */
table.cattotals tr[class*="cat-"] td:first-child::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--cc);
  vertical-align: 1px;
}
table.cattotals tr.zero td {
  color: var(--muted);
}
table.cattotals tr.zero td:first-child::before {
  opacity: .45;
}
table.cattotals tr.tot td {
  color: var(--brand);
  font-size: 17px;
}

/* Lead / job page cards: same colored stripe and title as the estimate cards */
.c-customer { --cc: var(--c-nav-leads); }
.c-contact { --cc: var(--c-interior); }
.c-site { --cc: var(--c-water); }
.c-job { --cc: var(--c-equipment); }
.c-builder { --cc: var(--c-nav-builders); }
.c-notes { --cc: var(--c-elec); }
.c-other { --cc: var(--c-demo); }
.c-estimates { --cc: var(--c-nav-plans); }
.c-contract { --cc: var(--c-nav-companies); }
.c-changes { --cc: var(--c-nav-atcs); }
.c-commission { --cc: var(--c-nav-comms); }
.c-mail { --cc: var(--c-plumbing); }
.card.tinted {
  border-left: 4px solid var(--cc);
}
.card.tinted > h2 {
  color: var(--cc);
}

.hint.c-needdist {
  color: var(--danger);
  margin-top: 6px;
}

/* Estimate Options › Custom items: narrow Use / Price / Category so the Item text has room */
table.c-customitems, table.c-picklist {
  table-layout: fixed;
  width: 100%;
}
table.c-customitems col.cu-use, table.c-picklist col.cu-use { width: 118px; }
table.c-customitems col.cu-price, table.c-picklist col.cu-price { width: 112px; }
table.c-customitems col.cu-cat, table.c-picklist col.cu-cat { width: 132px; }
table.c-customitems col.cu-del { width: 44px; }
table.c-customitems td input.w, table.c-customitems td select, table.c-picklist td select {
  width: 100%;
  min-width: 0;
  max-width: none;
}
table.c-customitems td input.n, table.c-picklist td input.n {
  width: 72px;
  min-width: 0;
}
@media (max-width:1280px) {
  table.c-customitems col.cu-use { width: 104px; }
  table.c-customitems col.cu-price { width: 96px; }
  table.c-customitems col.cu-cat { width: 100px; }
  table.c-customitems col.cu-del { width: 38px; }
  table.c-customitems td input.n { width: 66px; padding-left: 4px; padding-right: 4px; }
  table.c-customitems th, table.c-customitems td { padding-left: 4px; padding-right: 4px; }
}

/* Left menu: each section's icon in its own color */
nav button[data-v="leads"] svg { color: var(--c-nav-leads); }
nav button[data-v="plans"] svg { color: var(--c-nav-plans); }
nav button[data-v="atcs"] svg { color: var(--c-nav-atcs); }
nav button[data-v="comms"] svg { color: var(--c-nav-comms); }
nav button[data-v="builders"] svg { color: var(--c-nav-builders); }
nav button[data-v="prices"] svg { color: var(--c-nav-prices); }
nav button[data-v="settings"] svg { color: var(--c-nav-settings); }
nav button[data-v="companies"] svg { color: var(--c-nav-companies); }

/* Header: soft brand tint with a bold line underneath */
header {
  background: var(--panel);
  box-shadow: inset 0 -3px 0 var(--brand);
}

/* Buttons: brand-tinted outline and hover */
.btn:not(.primary):not(.danger) {
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line));
}
.btn:not(.primary):not(.danger):hover:not(:disabled) {
  background: var(--brand-soft);
  border-color: var(--brand);
}

/* ===== Test site label ===== */
.env-test body::after {
  content: "TEST SITE · test database";
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 50;
  padding: 6px 10px;
  border-radius: 8px;
  background: #b42318;
  color: #fff;
  font: 700 12px/1.2 system-ui, sans-serif;
  letter-spacing: .4px;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.env-test header {
  box-shadow: inset 0 -3px 0 #b42318;
}
@media print {
  .env-test body::after {
    display: none;
  }
}

/* ===== Utility classes ===== */
/* Utility classes (u-*) and small components (c-*) that replaced repeated inline styles.
   !important keeps them winning over component rules, the way the inline styles did. */
.u-mt-10 {
  margin-top: 10px !important;
}

.u-wrap {
  white-space: normal !important;
}

.u-mb-6 {
  margin-bottom: 6px !important;
}

.c-input-inline {
  flex: 1 !important;
  padding: 7px 8px !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  background: var(--panel) !important;
}

.u-maxw-90 {
  max-width: 90px !important;
}

.u-m-0-0-8 {
  margin: 0 0 8px !important;
}

.u-mt-12 {
  margin-top: 12px !important;
}

.u-mb-8 {
  margin-bottom: 8px !important;
}

.u-flex-1 {
  flex: 1 !important;
}

.u-mt-8 {
  margin-top: 8px !important;
}

.u-fs-12 {
  font-size: 12px !important;
}

.u-maxw-260 {
  max-width: 260px !important;
}

.u-mt-6 {
  margin-top: 6px !important;
}

.u-mt-0 {
  margin-top: 0 !important;
}

.u-mb-14 {
  margin-bottom: 14px !important;
}

.u-cols-2 {
  grid-template-columns: 1fr 1fr !important;
}

.u-hidden {
  display: none !important;
}

.u-row {
  display: flex !important;
  gap: 8px !important;
}

.u-row-wrap {
  flex-wrap: wrap !important;
}

.c-input-tiny {
  padding: 3px 6px !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  background: var(--panel) !important;
}

.u-maxw-640 {
  max-width: 640px !important;
}

.u-m-0-0-10 {
  margin: 0 0 10px !important;
}

.u-m-n6-0-10 {
  margin: -6px 0 10px !important;
}

.u-mb-10 {
  margin-bottom: 10px !important;
}

.u-noshadow {
  box-shadow: none !important;
}

/* Pick list card: group headings and the small quantity box */
table.c-picklist tr.pk-head td {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--cc, var(--brand));
  background: color-mix(in srgb, var(--cc, var(--brand)) 9%, transparent);
  border-left: 3px solid var(--cc, var(--brand));
  padding-top: 10px;
}
.u-w-70 {
  width: 70px;
}

/* ===== Warm theme (Settings › Theme › Warm): cream and orange, like the Claude app ===== */
:root[data-palette="warm"] {
  --bg: #f0eee6;
  --panel: #faf9f5;
  --panel2: #f5f3ec;
  --ink: #1f1e1d;
  --muted: #6b6862;
  --line: #e2ded2;
  --brand: #c15f3c;
  --brand-2: #d97757;
  --brand-soft: #f5e4da;
  --on-brand: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="warm"]:not([data-theme="light"]) {
    --bg: #262624;
    --panel: #30302e;
    --panel2: #383835;
    --ink: #f0eee6;
    --muted: #aaa79d;
    --line: #474641;
    --brand: #d97757;
    --brand-2: #e3906f;
    --brand-soft: #4a3329;
    --on-brand: #1f1e1d;
  }
}
:root[data-palette="warm"][data-theme="dark"] {
  --bg: #262624;
  --panel: #30302e;
  --panel2: #383835;
  --ink: #f0eee6;
  --muted: #aaa79d;
  --line: #474641;
  --brand: #d97757;
  --brand-2: #e3906f;
  --brand-soft: #4a3329;
  --on-brand: #1f1e1d;
}

/* Proposal: a line above the first section (POOL), same as the line under the letterhead */
.doc.proposal .dcols {
  border-bottom: 2px solid #1a1a1a;
  padding-bottom: 12px;
  margin-bottom: 14px;
}

/* Proposal: TOTAL QUOTE row filled with a light yellow (prints too) */
.doc.proposal table.dtable.grand td {
  background: #fff4d6;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* Printed documents: keep a section's heading with its lines, and don't split a line across pages */
.doc .dsec {
  break-inside: avoid;
}
.doc h4 {
  break-after: avoid;
}
.doc table.dtable tr {
  break-inside: avoid;
}

/* Proposal: category colors on paper (always the light-theme colors, even in dark mode) */
.doc {
  --c-pool: #1570cd;
  --c-spa: #0e8a7e;
  --c-tile: #6941c6;
  --c-interior: #c11574;
  --c-equipment: #c4560b;
  --c-plumbing: #0086c9;
  --c-water: #088ab2;
  --c-deck: #a15c07;
  --c-demo: #6b6157;
  --c-elec: #b08a00;
  --c-screen: #138a4b;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.doc h4.dcat {
  border-left: 4px solid var(--cc);
  padding-left: 8px;
  margin-top: 12px;
}
.doc .ddot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  background: var(--cc);
  vertical-align: 1px;
}
.doc .dsummary {
  margin-top: 14px;
}
.doc .dsummary table.dtable td {
  padding: 3px 6px;
}
/* Proposal: signature lines with room to sign */
.doc .sig.sig2 {
  margin-top: 40px;
  font-size: 11.5px;
  color: #333;
}
.doc .sig.sig2 div {
  border-top: 1px solid #333;
  text-align: left;
  padding-top: 5px;
}
.doc .sig.sig2 div.sigd {
  flex: 0 0 160px;
}

/* Collapsed or open, each Main card shows its category total on the title */
.card.ck > h2.ckh .cksub {
  margin-left: auto;
  padding-left: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}
.card.ck > h2.ckh:has(.cksub) {
  display: flex;
  align-items: center;
}

/* Estimate tabs stay at the top while scrolling (under the header); the totals box sits below them */
.tabs {
  position: sticky;
  top: var(--hdr-h, 57px);
  z-index: 4;
  background: var(--bg);
  padding-top: 4px;
}
.ws-side {
  top: calc(var(--hdr-h, 57px) + 56px);
}

/* Money and numbers: same-width digits so columns line up */
.num, td.num, table.mini, table.cattotals, .cksub, .dtable, input[type="number"], .readout {
  font-variant-numeric: tabular-nums;
}

/* Header save badge */
.savebadge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--ok);
  background: var(--ok-soft);
  white-space: nowrap;
}
.savebadge.busy {
  color: var(--warn);
  background: var(--warn-soft);
}
.savebadge.err {
  color: var(--danger);
  background: var(--danger-soft);
}
@media (max-width:820px) {
  .tabs {
    position: static;
  }
}
@media print {
  .savebadge {
    display: none;
  }
}

/* ===== Design refresh (2026-10-28): Inter font, calmer cards, sharper fields ===== */
:root {
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.05);
}
body {
  font-family: Inter,"Segoe UI",system-ui,-apple-system,Roboto,Arial,sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
header {
  min-height: 64px;
}
.brand {
  letter-spacing: -.02em;
}
h1, .pagehead .dn {
  letter-spacing: -.02em;
}
.card {
  padding: 18px 20px;
}
.card > h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.01em;
}

/* Cards with a category: a small color dot before a dark title (no side stripe, no colored title) */
.card.ck[class*="cat-"], .card.tinted {
  border-left: 1px solid var(--line);
}
.card.ck[class*="cat-"] > h2.ckh, .card.tinted > h2 {
  color: var(--ink);
}
.card.ck[class*="cat-"] > h2.ckh::before, .card.tinted > h2::before {
  content: "";
  order: -1;
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cc);
  margin-right: 4px;
  vertical-align: 1px;
}
.card.tinted > h2::before {
  margin-right: 10px;
}
.card.ck > h2.ckh {
  gap: 10px;
  margin: -2px 0 12px;
}
.card.ck.collapsed > h2.ckh {
  margin-bottom: -2px;
}
.card.ck > h2.ckh .ckc {
  order: 2;
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}
.card.ck > h2.ckh .cksub {
  order: 1;
  font-size: 15px;
  color: var(--ink);
}
.card.ck > h2.ckh:has(.cksub) .ckc {
  margin-left: 6px;
}

/* Form fields: a little taller, with a soft brand ring on the field you are typing in */
.fld input, .fld select, .fld textarea {
  padding: 9px 12px;
  min-height: 40px;
  border-color: color-mix(in srgb, var(--line) 70%, var(--muted));
  transition: border-color .12s, box-shadow .12s;
}
.fld label {
  font-size: 12.5px;
  font-weight: 500;
  color: color-mix(in srgb, var(--ink) 75%, var(--muted));
}
.fld input:focus, .fld select:focus, .fld textarea:focus, td input:focus, td select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent);
}

/* Buttons and tabs */
.btn {
  font-weight: 500;
  border-radius: 8px;
}
.btn.primary {
  font-weight: 600;
}
.tabs button {
  font-weight: 500;
}
.tabs button.on {
  font-weight: 600;
}

/* Left menu: quiet gray icons; the open page in the brand color */
nav button svg, nav button[data-v] svg {
  color: var(--muted);
}
nav button.on svg, nav button.on[data-v] svg {
  color: var(--brand);
}
nav button {
  font-weight: 500;
}

/* Smooth open/close feel */
.card.ck > h2.ckh .ckc {
  transition: transform .15s;
}

/* ===== Home dashboard ===== */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.kpi .kpi-l {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.kpi .kpi-v {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.kpi .kpi-s {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
}
.dash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}
.dash-pipe {
  position: relative;
}
.dash-pipe .dash-all {
  position: absolute;
  top: 14px;
  right: 16px;
}
.dash-act .act {
  display: flex;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  border-radius: 6px;
}
.dash-act .act:last-child {
  border-bottom: 0;
}
.dash-act .act:hover {
  background: var(--panel2);
}
.act-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex: none;
  background: var(--brand);
}
.act-lead { background: var(--c-pool); }
.act-quote { background: var(--brand); }
.act-sold { background: var(--ok); }
.act-co { background: var(--c-tile); }
@media (max-width: 1100px) {
  .dash {
    grid-template-columns: minmax(0, 1fr);
  }
}
.dash > .card, .dash-act .act > div { min-width: 0; }
.dash-act .act > div { overflow-wrap: anywhere; }
@media (max-width: 620px) {
  .dash-pipe .dp-des { display: none; }
  .dash-pipe td, .dash-pipe th { white-space: normal; }
  .dash-pipe td:first-child { overflow-wrap: anywhere; }
  .dash-pipe h2 { padding-right: 120px; }
}

/* ===== Sign-in screen ===== */
body.authmode nav {
  display: none;
}
body.authmode .app {
  grid-template-columns: minmax(0, 1fr);
}
body.authmode main {
  padding: 0;
}
.authbg {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  box-sizing: border-box;
  background:
    radial-gradient(1200px 300px at 50% 105%, rgba(255,255,255,.14), transparent 70%),
    linear-gradient(160deg, #0b3d4f 0%, #0a6a84 55%, #3fb3cf 100%);
}
.authbg .authcard {
  width: 100%;
  max-width: 420px;
  margin: 0;
  padding: 36px 32px;
  border-radius: 16px;
  border: 0;
  box-shadow: 0 24px 48px rgba(16,24,40,.25);
}
.authbg .authcard > h2 {
  text-align: center;
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
}
.authlogo {
  text-align: center;
  margin-bottom: 20px;
}
.authlogo svg, .authlogo img {
  width: 52px;
  height: 52px;
}
.authname {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-top: 10px;
}
.authtag {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}
.authform input {
  min-height: 44px;
}
.authform .btn.primary, .authform button[type="submit"] {
  min-height: 44px;
  justify-content: center;
}

/* ===== Motion: small, quick and calm ===== */
@keyframes we-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes we-open {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
@keyframes we-toast {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@keyframes we-spin {
  to { transform: rotate(360deg); }
}
main.pagein {
  animation: we-fadein .22s ease-out;
}
.card.ck.ckanim > :not(h2) {
  animation: we-open .2s ease-out;
}
.toast {
  animation: we-toast .2s ease-out;
}
.btn, nav button, .tabs button, .kpi, .prow, tr.click, .act {
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .08s;
}
.btn:active:not(:disabled) {
  transform: scale(.97);
}
.kpi:hover {
  box-shadow: 0 4px 12px rgba(16,24,40,.08);
}
.spinner {
  width: 34px;
  height: 34px;
  margin: 4px auto 12px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--brand) 20%, transparent);
  border-top-color: var(--brand);
  animation: we-spin .8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  main.pagein, .card.ck.ckanim > :not(h2), .toast, .spinner {
    animation: none;
  }
  .btn:active:not(:disabled) {
    transform: none;
  }
}
@media print {
  main.pagein {
    animation: none;
  }
}

/* WetEdge logo and wordmark */
.brand .we-logo {
  width: 32px;
  height: 32px;
  flex: none;
}
.we-edge {
  color: var(--brand);
}
.authlogo .we-logo {
  width: 56px;
  height: 56px;
}
.brand > div {
  font-weight: 800;
  letter-spacing: -.03em;
}
.brand small {
  letter-spacing: 0;
}

/* Pick list card: the spa offer's fields */
table.c-picklist .pk-spa {
  margin: 4px 0 6px;
}
table.c-picklist td .hint, table.c-picklist td.hint {
  white-space: normal;
}

/* Header: company logo and name on top, the signed-in person underneath */
.hdr-who {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
}
.hdr-who .co {
  color: var(--ink);
  font-weight: 600;
  font-size: 13.5px;
}
.hdr-who .co img {
  height: 26px;
}
.hdr-who .viewas {
  font-size: 12px;
}
.hdr-who .viewas select {
  font-size: 12px;
  padding: 2px 6px;
}
@media (max-width:820px) {
  .hdr-who {
    margin-left: auto;
  }
  .hdr-who .co {
    justify-content: flex-end;
    flex: none;
    max-width: 100%;
  }
}

/* Narrow screens (iPad): keep the company logo and name at the top right, on the same row as WetEdge */
@media (max-width:820px) {
  header {
    flex-wrap: nowrap;
    align-items: flex-start;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .hdr-right {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
  }
}
@media (max-width:520px) {
  header {
    flex-wrap: wrap;
  }
  .hdr-right {
    width: 100%;
    justify-content: space-between;
  }
}

/* Narrow screens: Sign out, Theme, version and save status at the bottom of each page */
.mobfoot {
  display: none;
}
@media (max-width:820px) {
  .mobfoot {
    display: block;
    margin-top: 28px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }
  .mobfoot .navnote {
    display: block;
    margin: 0;
    padding: 0;
    font-size: 12px;
  }
  .mobfoot .themepick select {
    font-size: 14px;
    padding: 6px 8px;
  }
  .mobfoot .btn {
    min-height: 36px;
  }
}
@media print {
  .mobfoot {
    display: none!important;
  }
}

/* ===== iPad and touch screens ===== */
:root {
  --hdr-h: 64px;
}
/* Estimate total bar: on narrower screens the total stays in view at the bottom, and the full
   breakdown moves below the cards (instead of pushing the cards down the page). */
.totbar {
  display: none;
}
@media (max-width:1180px) {
  .ws {
    grid-template-columns: minmax(0, 1fr);
  }
  .ws-side {
    position: static;
    order: 1;
  }
  .totbar {
    position: sticky;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 0;
    padding: 10px 12px 10px 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(16,24,40,.14);
    font-size: 14px;
    color: var(--muted);
  }
  .totbar b {
    margin-left: auto;
    font-size: 20px;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
  }
}
/* Menu on iPad: wrap onto two rows so every page (Price List, Settings) is visible without sideways scrolling */
@media (max-width:820px) {
  nav {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 2px 4px;
  }
  .tabs {
    top: 0;
  }
}
/* Finger-sized controls on touch screens */
@media (pointer: coarse) {
  .btn {
    min-height: 40px;
  }
  .btn.sm {
    min-height: 36px;
    padding-left: 12px;
    padding-right: 12px;
  }
  nav button, .tabs button {
    min-height: 44px;
  }
  .fld input, .fld select, .fld textarea, select.f, .search input {
    min-height: 44px;
    font-size: 16px;
  }
  td input, td select, .lrow select, .lrow input {
    min-height: 38px;
    font-size: 16px;
  }
  input[type=checkbox] {
    width: 22px;
    height: 22px;
  }
  .card.ck > h2.ckh {
    min-height: 40px;
  }
  .viewas select, .themepick select {
    min-height: 34px;
  }
}

/* iPad portrait: two fields per row (one per row only on phones) */
@media (max-width:820px) and (min-width:521px) {
  .form, .form.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width:820px) {
  .fspacer {
    display: none;
  }
}

/* Installed on an iPad home screen: keep the header clear of the status bar and the total bar clear of the home bar */
@media (display-mode: standalone) {
  header {
    padding-top: env(safe-area-inset-top);
  }
}

/* Company logo in dark themes: a soft light glow so dark logos stay visible */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .co img {
    filter: drop-shadow(0 0 3px rgba(255,255,255,.85)) drop-shadow(0 0 10px rgba(255,255,255,.55)) drop-shadow(0 0 18px rgba(255,255,255,.25));
  }
}
:root[data-theme="dark"] .co img {
  filter: drop-shadow(0 0 3px rgba(255,255,255,.85)) drop-shadow(0 0 10px rgba(255,255,255,.55)) drop-shadow(0 0 18px rgba(255,255,255,.25));
}

/* Home: getting-started checklist */
.card.setup {
  margin-bottom: 20px;
}
.setup-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.setup-top h2 {
  margin-bottom: 2px;
}
.setup-bar {
  height: 6px;
  border-radius: 99px;
  background: var(--panel2);
  overflow: hidden;
  margin: 12px 0 6px;
}
.setup-bar span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 99px;
  transition: width .3s;
}
.setup-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.setup-row:last-child {
  border-bottom: 0;
}
.setup-check {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--on-brand);
}
.setup-row.ok .setup-check {
  background: var(--ok);
  border-color: var(--ok);
}
.setup-row.ok .setup-t {
  color: var(--muted);
  text-decoration: line-through;
}
.setup-t {
  font-weight: 600;
  font-size: 14px;
}

/* Estimate total: estimated margin (owners and managers) */
.profitline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 13px;
}
.profitline b {
  font-size: 15px;
}
.profitline .muted {
  margin-left: auto;
}
.profitline.warn {
  background: var(--danger-soft);
  color: var(--danger);
}
.profitline > div {
  flex-basis: 100%;
}

/* Settings › Users & Roles: room for names, phones and emails; ID and commission kept narrow */
table.t-users td input[data-f="name"] {
  width: 100%;
  min-width: 180px;
}
table.t-users td input[data-f="phone"] {
  width: 100%;
  min-width: 150px;
}
table.t-users td input[data-f="email"] {
  width: 100%;
  min-width: 230px;
}
table.t-users td input[data-f="salesId"] {
  width: 56px;
  min-width: 0;
}
table.t-users td select[data-f="rate"] {
  width: 76px;
  min-width: 0;
}
table.t-users th, table.t-users td {
  padding-left: 6px;
  padding-right: 6px;
}

/* Screen card: item rows */
.u-maxw-120 {
  max-width: 120px;
}
.scr-row {
  align-items: center;
}
.scr-row .scr-name {
  min-width: 220px;
  flex: 1 1 220px;
}
/* Price list item tables: unit is a short code (EA, LF, SF), so give its room to the item name */
.pbody table.t-std th.col-unit {
  width: 72px;
}
.pbody table.t-std th.col-num {
  width: 84px;
}

/* Screen card: other items (not in the price list) */
table.t-scrother {
  width: 100%;
  table-layout: fixed;
}
table.t-scrother th:nth-child(2), table.t-scrother td:nth-child(2) { width: 80px; }
table.t-scrother th:nth-child(3), table.t-scrother td:nth-child(3) { width: 120px; }
table.t-scrother th:nth-child(4), table.t-scrother td:nth-child(4) { width: 100px; }
table.t-scrother th:nth-child(5), table.t-scrother td:nth-child(5) { width: 48px; }
table.t-scrother td input {
  width: 100%;
  min-width: 0;
}

/* ---------- Online proposals ---------- */
.propbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  max-width: 860px;
  margin: 0 auto 12px;
  border-left: 4px solid var(--brand);
}
.propbar.signed {
  border-left-color: #12b76a;
}
.propbar .muted {
  font-size: 13px;
  margin-top: 2px;
}
.propbar .proplink {
  width: 100%;
  max-width: 520px;
  margin-top: 8px;
  font-size: 12px;
}
.sigview {
  max-width: 860px;
  margin: 0 auto 12px;
}
.sigview img {
  display: block;
  max-width: 360px;
  width: 100%;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
body.signmode #hdr, body.signmode #nav, body.signmode .mobfoot {
  display: none !important;
}
body.signmode {
  background: #eef3f6;
}
body.signmode .app {
  display: block;
}
body.signmode main {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 16px 60px;
}
.signtop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 auto 14px;
  max-width: 860px;
}
.signintro, .signcard, .signdone {
  max-width: 860px;
  margin: 0 auto 16px;
}
.signintro h2, .signcard h2, .signdone h2 {
  margin-top: 0;
}
.signdone {
  border-left: 4px solid #12b76a;
}
.signdoc {
  margin-bottom: 16px;
}
.signstamp {
  margin-top: 10px;
  font-size: 13px;
}
.signcard h3 {
  margin: 14px 0 4px;
  font-size: 15px;
}
.signopts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 14px;
}
.signopt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.signopt span {
  flex: 1;
}
.signopt input, .signagree input {
  width: 20px;
  height: 20px;
  flex: none;
}
.signopt:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.signsum {
  width: 100%;
  margin: 6px 0 16px;
}
.signsum .grandrow td {
  font-size: 17px;
  border-top: 2px solid var(--line);
  padding-top: 8px;
}
.signlbl {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  margin: 12px 0 6px;
}
.signlbl .f {
  font-weight: 400;
  height: 44px;
  font-size: 16px;
}
.sigpad {
  position: relative;
}
.sigpad canvas {
  display: block;
  width: 100%;
  height: 170px;
  background: #fff;
  border: 1px dashed #98a2b3;
  border-radius: 8px;
  touch-action: none;
  cursor: crosshair;
}
.sigpad .btn {
  position: absolute;
  right: 8px;
  top: 8px;
}
.signagree {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 14px 0 6px;
  font-size: 14px;
  cursor: pointer;
}
.signerr {
  color: #b42318;
  min-height: 20px;
  margin: 6px 0;
  font-weight: 600;
}
.signbtn {
  width: 100%;
  height: 50px;
  font-size: 16px;
}
@media print {
  body.signmode {
    background: #fff;
  }
  body.signmode main {
    padding: 0;
  }
}
.signopt small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}
.signintro .btn {
  text-decoration: none;
}
.nowrap {
  white-space: nowrap;
}

/* ---------- Follow-up reminders ---------- */
.fucard {
  border-left: 4px solid #f79009;
}
.furow {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.furow:first-of-type {
  border-top: 0;
}
.furow .click {
  cursor: pointer;
  min-width: 220px;
}
.furow-b {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.furow-b a.btn {
  text-decoration: none;
  color: inherit;
}
.chip.fu {
  background: #fef0c7;
  color: #93370d;
}
.fu-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}
.btn.on {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip.fu {
    background: #4e2d0b;
    color: #fec84b;
  }
}
:root[data-theme="dark"] .chip.fu {
  background: #4e2d0b;
  color: #fec84b;
}

/* ---------- Estimate templates ---------- */
.u-maxw-760 {
  max-width: 760px;
}
.tplsave {
  border-left: 4px solid var(--brand);
}
select.tplpick {
  width: auto;
  max-width: 260px;
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
}
table.t-tpl input {
  width: 100%;
}

/* ---------- Build progress and Job Board ---------- */
.c-build {
  margin-bottom: 14px;
}
.bbar {
  height: 8px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
  margin-top: 8px;
}
.bbar span {
  display: block;
  height: 100%;
  background: #12b76a;
  border-radius: 99px;
}
table.t-build input[type=date] {
  max-width: 150px;
}
table.t-build td:nth-child(4) input {
  width: 100%;
  min-width: 140px;
}
table.t-build .bdone {
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}
.bdot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  margin-right: 8px;
  vertical-align: -1px;
}
table.t-build tr.done .bdot {
  background: #12b76a;
  border-color: #12b76a;
}
table.t-build tr.skip td {
  color: var(--muted);
}
table.t-build tr.skip .bdot {
  border-style: dashed;
}
.late, input.late {
  color: #b42318 !important;
  font-weight: 600;
}
table.t-board .bbar {
  margin: 2px 0 4px;
}

/* ---------- Helping a company (WetEdge admin) ---------- */
.helpbar {
  position: sticky;
  top: 72px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #fef0c7;
  color: #7a2e0e;
  border: 1px solid #fec84b;
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 14px;
  font-size: 13px;
}
.helpbar .btn {
  margin-left: auto;
}
.paycard {
  border-left: 4px solid #12b76a;
}
.payamt {
  align-self: center;
  margin-right: 6px;
}
table.mini tr.paydue td:first-child {
  font-weight: 600;
}

/* Settings › Lists: rows fit the card; up/down joined as one control */
.lrow input, .lrow textarea {
  min-width: 0;
}
.lrow .btn.icon, .lrow .mvgrp {
  flex: none;
}
.mvgrp {
  display: inline-flex;
}
.mvgrp .btn.icon {
  width: 28px;
  padding: 5px 0;
  justify-content: center;
  text-align: center;
}
.mvgrp .btn:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.mvgrp .btn:last-child {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: -1px;
}

/* ---------- Reports ---------- */
.rpgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.rpgrid .rpwide {
  grid-column: 1/-1;
}
.rpbars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rpbar {
  display: grid;
  grid-template-columns: minmax(90px, 30%) 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.rpl {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rptrack {
  height: 10px;
}
.rptrack span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 0 4px 4px 0;
}
.rpv {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 70px;
}
.rpv small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
}
.rpmonths {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
  align-items: end;
  height: 210px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}
.rpm {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
  padding-bottom: 20px;
}
.rpmbar {
  width: 70%;
  max-width: 36px;
  background: var(--brand);
  border-radius: 4px 4px 0 0;
}
.rpm:hover .rpmbar {
  background: var(--brand-2);
}
.rpmv {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.rpml {
  position: absolute;
  bottom: 2px;
  font-size: 11px;
  color: var(--muted);
}

/* ---------- Customer page (portal) ---------- */
.portcard {
  max-width: 860px;
  margin: 0 auto 16px;
}
.portcard h2 {
  margin-top: 0;
}
.portsteps {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}
.portsteps li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.portsteps li.done .bdot {
  background: #12b76a;
  border-color: #12b76a;
}
.portsteps li.next {
  font-weight: 600;
}
.portsteps li.next .bdot {
  border-color: var(--brand);
}
.portlogo {
  height: 28px;
  vertical-align: middle;
  margin-right: 8px;
}
details.portcard summary {
  cursor: pointer;
}

/* ---------- Drawings & files ---------- */
.c-files {
  margin-bottom: 14px;
}
label.btn.disabled {
  opacity: .6;
  pointer-events: none;
}
.filegrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.filecard {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
  display: flex;
  flex-direction: column;
}
.fthumb {
  all: unset;
  cursor: pointer;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  font-size: 40px;
}
.fthumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.fthumb:focus-visible {
  outline: 2px solid var(--brand);
}
.fmeta {
  padding: 8px 10px;
}
.fname {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.frow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
}
.fshare {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.portfiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.portfile {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
.portfile img, .pficon {
  height: 100px;
  width: 100%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  background: #eef3f6;
}
.pfname {
  padding: 6px 8px;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Files: folders and designs with the proposal */
.ftabs {
  margin-top: 10px;
  flex-wrap: wrap;
}
.ffold {
  width: 100%;
  margin-top: 6px;
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
}
.fchecks {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
  font-size: 12px;
}
.doc.designs {
  margin-top: 16px;
}
.dfig {
  margin: 0 0 16px;
  break-inside: avoid;
  page-break-inside: avoid;
}
.dfig img {
  display: block;
  max-width: 100%;
  max-height: 8.5in;
  margin: 0 auto;
  border: 1px solid #ddd;
}
.dfig figcaption {
  text-align: center;
  font-size: 12px;
  color: #555;
  margin-top: 6px;
}
@media print {
  .doc.designs {
    break-before: page;
    page-break-before: always;
    border: 0;
  }
}

/* ---------- Website lead form ---------- */
.leadcard {
  max-width: 640px;
  margin: 0 auto;
}
.leadcard h2 {
  margin-top: 0;
}
.leadgrid {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
}
.leadgrid .signlbl {
  flex: 1 1 100%;
  margin: 8px 0 4px;
}
.leadgrid .signlbl.half {
  flex: 1 1 200px;
}
.leadgrid textarea.f, .leadgrid select.f {
  font: inherit;
  font-weight: 400;
  font-size: 16px;
  padding: 8px 10px;
}
.leadgrid select.f {
  height: 44px;
}
.req {
  color: #b42318;
}
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
body.leadmode.embedded {
  background: transparent;
}
body.leadmode.embedded main {
  padding: 4px;
}

a.btn {
  text-decoration: none;
}

/* ---------- Build calendar ---------- */
.caltitle {
  min-width: 140px;
  text-align: center;
}
.calgrid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
}
.calh {
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.calc {
  min-height: 110px;
  padding: 6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.calc:nth-child(7n+7) {
  border-right: 0;
}
.calc.out {
  background: var(--panel2);
}
.calc.today {
  background: var(--brand-soft);
}
.calc.busy {
  box-shadow: inset 0 0 0 2px #f79009;
}
.cald {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.calbusy {
  background: #f79009;
  color: #fff;
  border-radius: 99px;
  padding: 0 6px;
  font-size: 11px;
}
.calev {
  all: unset;
  cursor: pointer;
  display: block;
  font-size: 12px;
  line-height: 1.3;
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calev b {
  font-weight: 600;
}
.calev.done {
  background: #12b76a;
}
.calev.past {
  background: #b42318;
}
.calev:focus-visible {
  outline: 2px solid var(--ink);
}
.callist {
  display: none;
}
@media (max-width: 760px) {
  .calgrid {
    display: none;
  }
  .callist {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .calday {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .caldh {
    font-weight: 600;
    font-size: 13px;
  }
  .caldh.today {
    color: var(--brand);
  }
  .calev {
    white-space: normal;
    padding: 6px 8px;
    font-size: 13px;
  }
}

/* Week & Day views */
.calseg { margin-right: 4px; }
.calnum { cursor: pointer; padding: 0 4px; border-radius: 6px; }
.calnum:hover { background: var(--brand-soft); color: var(--brand); }
.calweek .calc { min-height: 260px; }
.calweek .calev { white-space: normal; }
button.calhd { all: unset; cursor: pointer; padding: 8px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); text-align: center; }
button.calhd b { font-size: 15px; color: var(--ink); margin-left: 2px; }
button.calhd.today b { color: #fff; background: var(--brand); border-radius: 99px; padding: 1px 7px; }
button.calhd:hover { background: var(--brand-soft); }
.calnone { text-align: center; padding-top: 6px; }
.calrows { display: flex; flex-direction: column; gap: 0; padding: 4px 14px; }
.calrow { display: flex; gap: 14px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); border-left: 4px solid var(--brand); padding-left: 10px; }
.calrow:last-child { border-bottom: 0; }
.calrow.done { border-left-color: #12b76a; opacity: .75; }
.calrow.past { border-left-color: #b42318; }
.caltime { min-width: 74px; font-weight: 600; font-size: 13px; color: var(--muted); }
@media (max-width: 760px) {
  .calseg { width: 100%; }
  .caltime { min-width: 60px; }
}

/* ---------- Crews ---------- */
select.bcrew {
  max-width: 150px;
  font-size: 12px;
}
.calcrew {
  opacity: .85;
  font-size: 11px;
}
table.t-crews input {
  width: 100%;
  min-width: 90px;
}

.u-pre {
  white-space: pre-wrap;
  margin: 0;
}
.superpick select {
  font-size: 13px;
  padding: 3px 6px;
}

/* ---------- Permits & inspections ---------- */
.c-permits {
  margin-bottom: 14px;
}
table.t-permits input {
  width: 100%;
  min-width: 110px;
}
table.t-permits input[type=date] {
  max-width: 150px;
}
table.t-permits tr.done .bdot {
  background: #12b76a;
  border-color: #12b76a;
}
.ires-pass {
  color: #067647;
  font-weight: 600;
}
.ires-fail {
  color: #b42318;
  font-weight: 600;
}
.ires-partial, .ires-scheduled {
  color: #b54708;
}
select.f.sm {
  height: 32px;
  font-size: 13px;
  padding: 0 8px;
  width: auto;
}
.calev.insp {
  background: #6941c6;
}

/* ---------- Schedule (Gantt) ---------- */
.gscroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.gantt {
  --gl: 170px;
  position: relative;
  font-size: 12px;
}
.g-row {
  display: flex;
  min-height: 34px;
  border-bottom: 1px solid var(--line);
}
.g-row:last-child {
  border-bottom: 0;
}
.g-lab {
  flex: 0 0 var(--gl);
  width: var(--gl);
  padding: 6px 10px;
  border-right: 1px solid var(--line);
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--panel);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.g-lab b {
  font-weight: 600;
}
.g-lab[data-act] {
  cursor: pointer;
}
.g-lab[data-act]:hover b {
  color: var(--brand);
  text-decoration: underline;
}
.g-track {
  position: relative;
  flex: 1;
  min-width: 0;
}
.g-head {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--panel);
  min-height: 26px;
}
.g-scale.days {
  min-height: 40px;
}
.g-wk {
  position: absolute;
  top: 3px;
  padding-left: 3px;
  font-weight: 600;
  white-space: nowrap;
  border-left: 1px solid var(--line);
  color: var(--ink);
}
.g-dn {
  position: absolute;
  top: 18px;
  text-align: center;
  font-size: 10px;
  line-height: 1.1;
  color: var(--muted);
}
.g-dn.now {
  color: #fff;
  background: #f04438;
  border-radius: 4px;
}
.g-body {
  position: relative;
}
.g-bg {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--gl);
  right: 0;
  pointer-events: none;
}
.g-off {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(127, 127, 127, .09);
}
.g-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: #f04438;
  opacity: .7;
  z-index: 2;
}
.g-row.skip .g-lab {
  color: var(--muted);
  text-decoration: line-through;
}
.gbar {
  position: absolute;
  top: 6px;
  height: 22px;
  border-radius: 6px;
  background: #2e90fa;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  z-index: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
  min-width: 4px;
}
.gtxt {
  display: block;
  padding: 3px 6px;
  font-weight: 600;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gbar.now {
  background: #f79009;
}
.gbar.late {
  background: #f04438;
}
.gbar.done {
  background: #12b76a;
}
.gbar.dim {
  opacity: .22;
}
.gbar[data-g] {
  cursor: grab;
  touch-action: pan-y;
}
.gbar[data-act] {
  cursor: pointer;
}
.gbar[data-g][data-act] {
  cursor: grab;
}
.gbar.dragging {
  cursor: grabbing;
  z-index: 5;
  overflow: visible;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
  opacity: .92;
}
.gbar.dragging .gtxt {
  overflow: visible;
}
.gres {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  background: rgba(255, 255, 255, .35);
}
.gwait {
  position: absolute;
  top: 13px;
  height: 8px;
  border-radius: 0 4px 4px 0;
  background: repeating-linear-gradient(135deg, rgba(127, 127, 127, .35) 0 3px, transparent 3px 6px);
}
.g-none {
  position: absolute;
  left: 8px;
  top: 5px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 2;
}
.g-co .g-row {
  min-height: 40px;
}
.g-co .gbar {
  top: 9px;
}
.g-co .gwait {
  top: 16px;
}
.glegend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0 0 10px;
  align-items: center;
}
.glegend span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.gl {
  display: inline-block;
  width: 14px;
  height: 10px;
  border-radius: 3px;
  background: #2e90fa;
}
.gl.now {
  background: #f79009;
}
.gl.late {
  background: #f04438;
}
.gl.done {
  background: #12b76a;
}
.gl.wait {
  background: repeating-linear-gradient(135deg, rgba(127, 127, 127, .5) 0 3px, transparent 3px 6px);
}
table.t-sdays input {
  max-width: 90px;
}
@media (max-width: 700px) {
  .gantt {
    --gl: 110px;
  }
}

/* ---------- Work orders ---------- */
.wobtn {
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--muted);
  border-radius: 999px;
  font-size: 11px;
  padding: 1px 8px;
  margin-left: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.wobtn:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.wobtn.wo-sent {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: transparent;
}
.wobtn.wo-confirm, .wobtn.wo-done {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: transparent;
}
.wobtn.wo-decline {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}
.wocard {
  border-left: 4px solid var(--brand);
}
.wocard textarea {
  width: 100%;
}
.wonote {
  margin-top: 6px;
  font-style: italic;
}
.gbar.wo-confirm::after, .gbar.wo-decline::after, .gbar.wo-sent::after {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 9px;
  line-height: 14px;
  text-align: center;
  color: #fff;
  font-weight: 700;
  border: 1px solid #fff;
}
.gbar.wo-confirm::after {
  content: "✓";
  background: #067647;
}
.gbar.wo-decline::after {
  content: "!";
  background: #b42318;
}
.gbar.wo-sent::after {
  content: "✉";
  background: #a15c07;
  font-size: 8px;
}
.gbar.wo-confirm, .gbar.wo-decline, .gbar.wo-sent {
  overflow: visible;
}
.gbar.wo-confirm .gtxt, .gbar.wo-decline .gtxt, .gbar.wo-sent .gtxt {
  overflow: hidden;
  border-radius: 6px;
}
.wodates {
  font-size: 18px;
  font-weight: 600;
}
.woask p {
  margin-top: 0;
}
.wonotes {
  white-space: pre-wrap;
}
.woscope-h {
  font-size: 14px;
  margin: 12px 0 4px;
}
.woscope {
  margin: 0;
  padding-left: 20px;
}

/* ---------- Purchase orders ---------- */
.c-pos {
  margin-bottom: 14px;
}
table.t-pos tr.on td {
  background: var(--brand-soft);
}
.poed {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.poed h3 {
  margin: 0;
}
table.t-poitems input {
  width: 100%;
  min-width: 70px;
}
table.t-poitems td:first-child input {
  min-width: 220px;
}
table.t-poitems input.pounit {
  max-width: 70px;
}
.popick {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--panel2);
  max-height: 340px;
  overflow: auto;
}
.popl {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
  cursor: pointer;
}
.potag {
  font-size: 11px;
  border-radius: 999px;
  padding: 1px 7px;
  background: var(--brand-soft);
  color: var(--brand);
  white-space: nowrap;
}
.potag.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.potag.draft {
  background: var(--warn-soft);
  color: var(--warn);
}
table.t-poitems td:nth-child(2) input {
  max-width: 80px;
}
table.t-poitems td:nth-child(4) input {
  max-width: 110px;
}
table.t-poitems td:first-child {
  width: 50%;
}
table.t-wos tr.on td {
  background: var(--brand-soft);
}
.wonew {
  border-left: 4px solid var(--brand);
}

/* ---------- Job cost ---------- */
.c-cost {
  margin-bottom: 14px;
}
.ctiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.ctile {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--panel);
}
.ctl {
  font-size: 12px;
  color: var(--muted);
}
.ctv {
  font-size: 20px;
  font-weight: 700;
  margin: 2px 0;
}
.cts {
  font-size: 12px;
  color: var(--muted);
}
.ctile.neg .ctv {
  color: var(--danger);
}
.cbars {
  display: grid;
  gap: 6px;
  max-width: 640px;
}
.cbar {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.cbar span:first-child {
  flex: 0 0 150px;
}
.cbtrack {
  flex: 1;
  height: 8px;
  background: var(--panel2);
  border-radius: 4px;
  overflow: hidden;
}
.cbtrack i {
  display: block;
  height: 100%;
  background: var(--brand);
}
table.t-bills input:not([type=checkbox]), table.t-bills select {
  width: 100%;
  min-width: 90px;
}
table.t-bills input[type=date] {
  min-width: 130px;
}
table.t-bills select {
  min-width: 130px;
}

/* ---------- Crews & Suppliers ---------- */
.vgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
.vcard {
  margin: 0;
}
.vtop {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.vtop h3 {
  margin: 0 0 2px;
  font-size: 16px;
}
.vform {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin-top: 10px;
}
.vf {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: var(--muted);
  gap: 2px;
}
.vf input {
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
}
.vstats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}
.vstats b {
  color: var(--ink);
}
.vup {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 13px;
}
.vup li {
  padding: 4px 0;
  border-top: 1px dashed var(--line);
}
.vup li.late b {
  color: var(--danger);
}
@media (max-width: 500px) {
  .vgrid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.vtop h3 {
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}
.vf input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.vform > * {
  min-width: 0;
}

/* ---------- Settings › Features ---------- */
.featrow {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.featrow input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
}
.featrow > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.featrow.off {
  opacity: .55;
  cursor: default;
}
.card.cklocked .ckh {
  cursor: not-allowed;
  opacity: .6;
}
.ckneed {
  margin-bottom: 10px;
}
.req {
  color: var(--danger);
  font-weight: 700;
  margin-left: 2px;
}
.fld:has(.req.miss) input, .fld:has(.req.miss) select {
  border-color: #f79009;
  box-shadow: 0 0 0 3px rgba(247, 144, 9, .18);
  background: var(--warn-soft);
}
.card.cklocked .ckh {
  cursor: pointer;
}
h3.defh {
  margin: 16px 0 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
h3.defh:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 4px;
}
table.t-std td:first-child input {
  width: 100%;
  min-width: 0;
}
.pbody table.t-std th.catc {
  width: 130px;
}
.pbody table.t-std th:first-child {
  width: 20%;
}
.pbody table.t-std td input.w {
  min-width: 0 !important;
  width: 100%;
}
.pbody table.pt-demo th.col-unit {
  width: 72px;
}
.doc table.csec {
  margin-bottom: 10px;
}
.doc table.csec thead th {
  text-align: left;
  font-size: 12px;
  letter-spacing: .04em;
}
.doc table.csec td.num {
  width: 120px;
}

/* ---------- Sales tools ---------- */
.chip.hot {
  background: #fff1e6;
  color: #c4320a;
  font-weight: 700;
}
.hotcard {
  border-left: 4px solid #f97316;
}
.apptcard .furow.today b {
  color: var(--brand);
}
.calev.appt {
  background: #0e9384;
}
.lostcard {
  border-left: 4px solid var(--danger);
  margin-bottom: 14px;
}
.c-appts {
  margin-bottom: 14px;
}
table.t-appts input, table.t-appts select {
  width: 100%;
  min-width: 90px;
}
table.t-appts tr.past td {
  color: var(--muted);
}
.signexp {
  margin: 10px 0;
}
table.t-appts td.nowrap .btn {
  margin-left: 4px;
}
.calrow.appt { border-left-color: #0e9384; }
.calrow.insp { border-left-color: #6941c6; }
.calrow.done { border-left-color: #12b76a; }
.calrow.past { border-left-color: #b42318; }
.pdbar summary { cursor: pointer; font-size: 13px; }
.pdlist { margin: 6px 0 0; padding-left: 18px; font-size: 13px; columns: 2; column-gap: 24px; }
@media (max-width: 760px) { .pdlist { columns: 1; } }

/* Phone month grid */
.calmini { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 6px; }
.calmini > b { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding-bottom: 4px; }
.cmd { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 5px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--ink); min-height: 38px; }
.cmd > span:first-child { width: 28px; height: 28px; line-height: 28px; text-align: center; border-radius: 99px; }
.cmd.today > span:first-child { color: #fff; background: var(--brand); font-weight: 700; }
.cmd.sel { background: var(--brand-soft); }
.cmd:focus-visible { outline: 2px solid var(--brand); }
.cdots { display: flex; gap: 3px; height: 6px; align-items: center; }
.cdot { width: 6px; height: 6px; border-radius: 99px; background: var(--brand); display: block; }
.cdot.d-appt { background: #0e9384; }
.cdot.d-insp { background: #6941c6; }
.cdot.d-late { background: #b42318; }
.cdot.d-done { background: #12b76a; }
.cmore { font-style: normal; font-size: 10px; line-height: 6px; color: var(--muted); }
@media (max-width: 760px) {
  .calseg { display: flex; }
  .calseg button { flex: 1; }
  .pagehead .actions .caltitle { flex: 1; min-width: 0; align-self: center; }
  .calmob .calday { margin-top: 10px; }
}

/* Leads list as cards on phones */
td.lt-brk { display: none; }
@media (max-width: 620px) {
  table.leadtbl thead { display: none; }
  table.leadtbl, table.leadtbl tbody { display: block; }
  table.leadtbl tr { display: flex; flex-wrap: wrap; align-items: center; row-gap: 2px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.leadtbl tr:last-child { border-bottom: 0; }
  table.leadtbl td { display: block; border: 0; padding: 0; white-space: normal; font-size: 13px; color: var(--muted); }
  table.leadtbl td.lt-name { order: 1; flex: 1 1 0; min-width: 0; font-size: 15px; color: var(--ink); overflow-wrap: anywhere; padding-right: 8px; }
  table.leadtbl td.lt-st { order: 2; flex: 0 0 auto; text-align: right; }
  table.leadtbl td.lt-brk { display: block; order: 3; flex-basis: 100%; height: 0; }
  table.leadtbl td.lt-x { order: 4; }
  table.leadtbl td.lt-b2 { order: 5; }
  table.leadtbl td.lt-y { order: 6; }
  table.leadtbl td.lt-x:empty { display: none; }
  table.leadtbl td.lt-x:not(:empty) ~ td.lt-x:not(:empty)::before { content: '·'; margin: 0 6px; }
  table.leadtbl td.lt-y[data-l]::before { content: attr(data-l); }
  table.leadtbl td.lt-y ~ td.lt-y::before { content: '· ' attr(data-l); margin-left: 6px; }
  table.leadtbl td.lt-y:not([data-l]) ~ td.lt-y::before, table.leadtbl td.lt-y ~ td.lt-y:not([data-l])::before { content: '· '; }
  table.leadtbl td.empty { flex: 1; text-align: center; }
}

/* List tables as cards on phones (mobCards in ui.js) */
@media (max-width: 620px) {
  table.mcard thead { display: none; }
  table.mcard, table.mcard tbody { display: block; min-width: 0 !important; width: 100%; }
  table.mcard tbody > tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.mcard tbody > tr:last-child { border-bottom: 0; }
  table.mcard tbody > tr > td { display: block; border: 0; padding: 0; white-space: normal; text-align: left; font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
  table.mcard tbody > tr > td:first-child { flex: 1 1 100%; font-size: 15px; }
  table.mcard tbody > tr > td[data-l]::before { content: attr(data-l) ': '; color: var(--muted); }
  table.mcard tbody > tr > td[data-l]:empty { display: none; }
  table.mcard tbody > tr > td[colspan] { flex: 1 1 100%; text-align: center; }
}
/* Phones: a table placed straight in a card scrolls inside the card instead of widening the page */
@media (max-width: 620px) {
  .card > table:not(.mcard):not(.leadtbl) { display: block; overflow-x: auto; max-width: 100%; }
}

@media (max-width: 1000px) { .card.bplace { display: none; } }

.fld input[readonly], .fld textarea[readonly] { border-style: dashed; cursor: default; }

/* Builders: list first; on phones the picked builder shows on its own with a back button */
.bback { display: none; }
@media (max-width: 1000px) {
  .bdetail.has-sel > .tablewrap { display: none; }
  .bback { display: inline-flex; margin-bottom: 10px; }
}

/* Phones: commission lines table scrolls inside the statement */
@media (max-width: 620px) {
  .doc table.ctable { display: block; overflow-x: auto; max-width: 100%; }
}

/* Phones: Change Order lines stack (description, then cost) */
@media (max-width: 620px) {
  .card > table.atclines { display: table; width: 100%; overflow: visible; }
  table.atclines thead { display: none; }
  table.atclines tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.atclines td { display: block; border: 0; padding: 0; }
  table.atclines td:first-child { flex: 1 1 100%; }
  table.atclines td:first-child input { width: 100%; }
  table.atclines td.num { display: flex; align-items: center; gap: 8px; margin-left: auto; }
  table.atclines td.num::before { content: attr(data-l); color: var(--muted); font-size: 13px; }
  table.atclines td.num input { width: 130px; }
}

.doc .dscrnote { margin: 6px 0 0; font-size: 12.5px; }

.scrbid { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; font-size: 13px; line-height: 1.45; cursor: pointer; }
.scrbid input { margin-top: 3px; flex: none; width: 18px; height: 18px; }
.doc h4.dsubhead { margin: 14px 0 4px; font-size: 12px; letter-spacing: .06em; }
.signopt.needspa { opacity: .5; }
.signopt.needspa span::after { content: ' (tick Add spa first)'; font-size: 12px; color: var(--muted); }

fieldset.planlock { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.planlock input, fieldset.planlock select, fieldset.planlock textarea { opacity: .75; cursor: not-allowed; }
.planlockbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
a.btn { color: var(--ink); }
.propbar .u-row { flex-wrap: wrap; }

/* Phones: Options tab tables stack (item on top, then choices) */
@media (max-width: 620px) {
  table.o1tbl, table.c-picklist, table.c-customitems { display: block; width: 100%; }
  table.o1tbl thead, table.c-picklist thead, table.c-customitems thead, table.c-picklist colgroup, table.c-customitems colgroup { display: none; }
  table.o1tbl tbody, table.c-picklist tbody, table.c-customitems tbody { display: block; }
  table.o1tbl tr, table.c-picklist tr:not(.pk-head), table.c-customitems tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.c-picklist tr.pk-head { display: block; }
  table.c-picklist tr.pk-head td { display: block; }
  table.o1tbl td, table.c-picklist tr:not(.pk-head) td, table.c-customitems td { display: block; border: 0; padding: 0; white-space: normal; min-width: 0; }
  table.o1tbl td:first-child { flex: 1 1 100%; font-weight: 600; }
  table.o1tbl td:nth-child(2) { flex: 1 1 100%; }
  table.o1tbl td:nth-child(2) select { width: 100%; max-width: none; }
  table.o1tbl td.num { font-weight: 600; }
  table.o1tbl td:nth-child(4), table.c-picklist tr td:nth-child(4), table.c-customitems td:nth-child(4) { margin-left: auto; color: var(--muted); font-size: 13px; }
  table.c-picklist tr:not(.pk-head) td:nth-child(2), table.c-customitems td:nth-child(2) { order: -1; flex: 1 1 100%; font-weight: 600; }
  table.c-customitems td:nth-child(2) input.w { width: 100%; }
  table.c-picklist td.num, table.c-customitems td:nth-child(3) { font-weight: 600; }
  table.c-customitems td:nth-child(4) select { width: auto; }
  table.c-picklist td[colspan] { flex: 1 1 100%; }
}

.psortsel { display: none; }
@media (max-width: 620px) { .psortsel { display: block; } }
/* Screen items: the quantity box keeps its size; the name takes the rest */
.scr-row .scr-name { flex: 1 1 auto; min-width: 0; }
.scr-row input { flex: 0 0 84px; width: 84px; min-width: 84px; }
.scr-row > span.muted { flex: 0 0 26px; }
.qtabs { margin-bottom: 10px; }

.rpstats { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 10px; }
.rpstats > div { display: flex; flex-direction: column; }
.rpstats b { font-size: 22px; }
.rpstats span { font-size: 12px; color: var(--muted); }
.rpf { display: grid; grid-template-columns: 110px minmax(0, 1fr) 120px; gap: 10px; align-items: center; margin: 6px 0; }
.rpfl { font-size: 13px; }
.rpf .rpv small { display: block; color: var(--muted); font-size: 11px; }
/* Phones: KPI tiles two across and compact (Home and Reports) */
@media (max-width: 620px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
  .kpis .card.kpi { padding: 12px 14px; }
  .kpi .kpi-l { font-size: 12px; }
  .kpi .kpi-v { font-size: 22px; margin-top: 2px; }
  .kpi .kpi-s { font-size: 11.5px; line-height: 1.35; }
  .rpstats b { font-size: 18px; }
}

/* Phones: folded menu */
.navtoggle { display: none !important; }
@media (max-width: 820px) {
  nav .navtoggle { display: flex !important; width: 100%; align-items: center; gap: 8px; font-weight: 600; }
  nav .navtoggle .navtog-r { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 600; }
  nav:not(.open) > button:not(.navtoggle) { display: none; }
  nav.open .navtoggle { margin-bottom: 4px; }
}

/* ---------- Lead stages ---------- */
.stagecard { padding: 14px 16px; }
.stagebar { display: flex; gap: 2px; overflow-x: auto; padding-bottom: 4px; }
.stg { all: unset; cursor: pointer; flex: 1 1 0; min-width: 64px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border-radius: 10px; position: relative; }
.stg:not(:last-child)::after { content: ''; position: absolute; top: 18px; left: calc(50% + 15px); right: calc(-50% + 15px); height: 2px; background: var(--line); }
.stg.done:not(:last-child)::after { background: var(--brand); }
.stdot { width: 26px; height: 26px; border-radius: 99px; display: grid; place-items: center; font-size: 12px; font-weight: 700; border: 2px solid var(--line); background: var(--panel); color: var(--muted); z-index: 1; }
.stg.done .stdot { background: var(--brand); border-color: var(--brand); color: #fff; }
.stg.on .stdot { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.stl { font-size: 12px; font-weight: 600; color: var(--muted); }
.stg.on .stl, .stg.done .stl { color: var(--ink); }
.std { font-size: 10.5px; color: var(--muted); }
.stg:hover .stdot { border-color: var(--brand); }
.stg:focus-visible { outline: 2px solid var(--brand); }
.stagebody { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.stagechk { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; align-items: center; }
.stagechk label { display: flex; gap: 6px; align-items: center; font-size: 13px; cursor: pointer; }
.stagechk label.on { color: var(--muted); text-decoration: line-through; }
.stagemsgs { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; }
.stmsg { display: inline-flex; gap: 6px; align-items: center; }
.stchip { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.stchip.st-new { background: #fef0c7; color: #93370d; }
.stchip.st-proposal { background: #d1fadf; color: #05603a; }
.stchip.st-sold { background: #12b76a; color: #fff; }
.nacard .naitem { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.nacard { border-left: 4px solid #f79009; }
/* Pipeline board */
.ppboard { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.ppcol { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-height: 120px; display: flex; flex-direction: column; gap: 8px; }
.pphead { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 2px 4px 4px; }
.ppcard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; cursor: grab; }
.ppcard.hold { opacity: .75; }
.ppcard .ppmove { font-size: 12px; padding: 4px 6px; }
.ppempty { text-align: center; padding: 10px 0; }
@media (min-width: 821px) { .ppcard .ppmove { display: none; } .ppcard:hover .ppmove { display: block; } }
@media (max-width: 620px) {
  .ppboard { grid-auto-columns: 78%; scroll-snap-type: x mandatory; }
  .ppcol { scroll-snap-align: start; }
  .stg { min-width: 56px; }
  .stl { font-size: 11px; }
}
.nacard .naitem > div:first-child { flex: 1 1 280px; min-width: 0; }

.qhead { margin-top: 10px; display: flex; gap: 8px; align-items: center; }
.qform { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 12px; margin-top: 6px; }
.qf { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.qf select, .qf input { font-size: 14px; color: var(--ink); }
.qsum { margin-top: 10px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.qf input.f { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); min-height: 38px; box-sizing: border-box; }

/* Contract terms (Settings › Documents, proposal, customer page) and signed signature lines */
.doc .dcontract { break-before: page; }
.doc .dcontract h5 { font: 600 12px/1.4 Arial, sans-serif; margin: 12px 0 3px; color: #222; }
.doc .dcontract .dfine { margin: 0 0 4px; }
.doc .sig.sig2.signed { margin-top: 18px; }
.doc .sig.signed div { border-top: 0; padding-top: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.doc .sig.signed div > span { display: block; border-top: 1px solid #333; padding-top: 5px; }
.doc .sig.signed .sigimg { display: block; height: 56px; max-width: 240px; object-fit: contain; object-position: left bottom; margin-bottom: 2px; }
.ccard { max-width: 860px; margin-top: 16px; }
.ccard .featrow { margin: 10px 0; }
.ccard .csec { margin: 12px 0; }
.ccard .csechead { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.ccard .csechead input { flex: 1; font-weight: 600; min-width: 0; }
.ccard .cnum { font-weight: 600; min-width: 22px; }
.ccard textarea { width: 100%; }
.counterbar { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; max-width: 860px; margin: 0 auto 12px; border-left: 4px solid #f79009; }
.counterbar .muted { font-size: 13px; margin-top: 2px; }
.counterbar.counteropen .sigpad { max-width: 520px; margin-bottom: 8px; }
.counterbar.counteropen .signlbl input { max-width: 320px; display: block; }
@media (max-width: 600px) {
  .doc .sig.sig2 { gap: 12px; }
  .doc .sig.sig2 div { min-width: 0; }
  .doc .sig.sig2 div.sigd { flex: 0 0 92px; }
}

/* Signature block: client and contractor side by side (stacked on phones) */
.doc .sgblock { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 22px; font-family: Arial, sans-serif; font-size: 11.5px; color: #222; break-inside: avoid; }
.doc .sgparty { border: 1px solid #d0d5dd; border-radius: 6px; padding: 10px 12px 8px; }
.doc .sghead { font-weight: 700; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #344054; margin-bottom: 6px; }
.doc .sgsig { height: 58px; display: flex; align-items: flex-end; }
.doc .sgsig .sigimg { height: 54px; max-width: 100%; object-fit: contain; object-position: left bottom; }
.doc .sgline { border-top: 1px solid #333; padding-top: 3px; margin-bottom: 8px; color: #555; }
.doc .sgesig { color: #12b76a; font-size: 10.5px; }
.doc .sgrow { display: flex; align-items: flex-end; gap: 8px; min-height: 22px; }
.doc .sgl { flex: 0 0 74px; color: #555; }
.doc .sgv { flex: 1; border-bottom: 1px solid #98a2b3; padding: 0 2px 2px; min-height: 16px; }
@media (max-width: 600px) { .doc .sgblock { grid-template-columns: 1fr; gap: 14px; } }
/* Pool card title: description, surface area, perimeter and depths (shows when collapsed) */
.card.ck > h2.ckh .ckinfo { margin-left: 14px; font-size: 12.5px; font-weight: 400; color: var(--muted); letter-spacing: 0; text-transform: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.ck > h2.ckh:has(.ckinfo) { display: flex; align-items: center; flex-wrap: wrap; row-gap: 2px; }
@media (max-width: 600px) { .card.ck > h2.ckh .ckinfo { order: 3; flex-basis: 100%; margin-left: 22px; font-size: 12px; white-space: normal; } }
/* Deck items (try-out): the amount box never squeezes; on phones the dropdown gets its own line */
.lrow.dkrow input.dkq { flex: 0 0 96px; min-width: 80px; max-width: 110px; }
@media (max-width: 600px) {
  .lrow.dkrow { flex-wrap: wrap; row-gap: 6px; }
  .lrow.dkrow select.c-input-inline { flex: 1 1 100% !important; min-width: 0; }
  .lrow.dkrow input.dkq { flex: 1 1 auto; max-width: none; }
}
.spadescrow { gap: 6px; flex-wrap: nowrap; align-items: center; }
.spadescrow input, .spadescrow select { flex: 1; min-width: 0; }
/* Design pictures: two to a printed page when they fit (PDF site-plan pages stay full size) */
@media print {
  .dfig.dphoto { margin: 0 0 10px; }
  .dfig.dphoto img { max-height: 4.25in; width: auto; max-width: 100%; }
}
.doc .dtable tr.dnoterow td { font-size: 11.5px; font-style: italic; color: #444; border-bottom: 0; padding-top: 2px; }
.prow .btn.icon { margin-left: 6px; }
.prow.phidden { opacity: .6; }
/* Contract: owner details and Florida notices */
.doc .dkv { display: flex; gap: 8px; font-size: 12.5px; line-height: 1.45; }
.doc .dkv span:first-child { flex: 0 0 132px; color: #555; }
.doc .dnotices { margin-top: 18px; }
/* Florida notices: contract font (Arial), all three the same 12-point bold capitals (s. 713.015 requires 12 pt for the lien notice) */
.doc .dlien { border: 1px solid #333; padding: 10px 12px; margin: 0 0 12px; break-inside: avoid; page-break-inside: avoid; }
.doc .dlien p { margin: 0; font-family: inherit; font-size: 12pt; font-weight: 700; font-style: normal; line-height: 1.35; text-transform: uppercase; color: #1a1a1a; }
/* Contract page 2: Additional Provisions, Warranty, Florida notices, ACCEPTED (owner signature + date) */
.doc .dpage2 { break-before: page; page-break-before: always; }
.doc .dpage2 h4.dcenter { text-align: center; margin-top: 16px; }
.doc .daccept { margin-top: 14px; break-inside: avoid; }
.doc .accrow { display: flex; gap: 24px; margin-top: 14px; font-size: 11.5px; color: #333; }
.doc .accsig { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; min-height: 40px; }
.doc .accsig .sigimg { height: 50px; max-width: 240px; object-fit: contain; object-position: left bottom; }
.doc .accsig > span, .doc .accdate > span { display: block; border-top: 1px solid #333; padding-top: 4px; }
.doc .accdate { flex: 0 0 150px; display: flex; flex-direction: column; justify-content: flex-end; }
.doc .dlienpage { break-inside: avoid; page-break-inside: avoid; }
.u-maxw-860 { max-width: 860px; margin-left: auto; margin-right: auto; }
/* Printing (Letter): keep headings with their text, and everything that is signed on the same page as its signatures */
@media print {
  .doc h4, .doc h5 { break-after: avoid; page-break-after: avoid; }
  .doc .dsec h5 + p { break-before: avoid; }
  .doc .dagree, .doc .dlienpage, .doc .daccept, .doc .sgblock, .doc .dsummary, .doc table.grand { break-inside: avoid; page-break-inside: avoid; }
  .doc .dsec:has(> h4 + table.dtable) table.dtable tr { break-inside: avoid; }
  .doc .dcontract h5 { break-after: avoid; }
}
/* Owner + co-owner + contractor signature boxes; a shared online signature image shows its top or bottom half */
.doc .sgblock.three { grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.doc .sgsig .sigimg.half1, .doc .sgsig .sigimg.half2 { width: 270px; max-width: 100%; height: 54px; object-fit: cover; }
.doc .sgsig .sigimg.half1 { object-position: left top; }
.doc .sgsig .sigimg.half2 { object-position: left bottom; }
@media (max-width: 600px) { .doc .sgblock.three { grid-template-columns: 1fr; } }
/* Signed Documents card and the saved signed-copy viewer */
.c-signed .sdrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.c-signed .sdrow:first-of-type { border-top: 0; }
.c-signed .sdic { font-size: 20px; }
.archframe { width: 100%; height: calc(100vh - 190px); min-height: 520px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
/* Signed Documents card: its own dot color (was an empty gap) */
.c-signed { --cc: var(--c-nav-companies); }
/* Contract & payments table: date / method pickers shrink so the card never pushes the page sideways */
.c-contract table.mini { width: 100%; table-layout: auto; }
.c-contract table.mini td { overflow-wrap: anywhere; }
.c-contract table.mini input, .c-contract table.mini select { max-width: 100%; min-width: 0; box-sizing: border-box; }
.detail > *, .stack > * { min-width: 0; }
/* Correspondence: long subjects wrap instead of pushing the page sideways */
.c-mail table.mini { width: 100%; table-layout: auto; }
.c-mail table.mini td { white-space: normal; overflow-wrap: anywhere; }
.c-mail table.mini td:first-child, .c-mail table.mini td.num { white-space: nowrap; overflow-wrap: normal; }
.c-mail table.mini select { max-width: 100%; }

/* Customer page: signed-document viewer */
.phview { position: fixed; inset: 0; z-index: 1000; background: rgba(15,23,29,.6); display: flex; flex-direction: column; padding: 12px; }
.phbar { display: flex; align-items: center; gap: 8px; background: var(--panel); color: var(--ink); padding: 10px 12px; border-radius: 10px 10px 0 0; min-width: 0; }
.phbar b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.phbody { flex: 1; background: #fff; border-radius: 0 0 10px 10px; overflow: hidden; display: flex; }
.phbody iframe { flex: 1; width: 100%; height: 100%; border: 0; background: #fff; }

/* Customers list: one row per customer, projects inside */
.custtbl .lt-proj { white-space: normal; }
.custtbl .projchip { margin: 2px 6px 2px 0; font-weight: 500; }

.c-other .prow.pcur { cursor: default; border-style: dashed; }

/* Lead page: which project is open (customers with several projects) */
.projno { color: var(--brand); font-weight: 700; }
.projtabs { display: flex; gap: 8px; flex-wrap: wrap; margin: -4px 0 14px; }
.projtab { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); cursor: pointer; text-align: left; font: inherit; min-width: 0; }
.projtab span { font-size: 12px; color: var(--muted); }
.projtab:hover { background: var(--panel2); }
.projtab.on { border: 2px solid var(--brand); background: var(--brand-soft); cursor: default; }
.projtab.on b { color: var(--brand); }

/* Drawings & Files: send files */
.filecard { position: relative; }
.filecard .fpick { position: absolute; top: 6px; left: 6px; z-index: 2; background: var(--panel); border-radius: 6px; padding: 2px 4px; box-shadow: var(--shadow); }
.filecard .fpick input { width: 18px; height: 18px; }
.filecard.fsel { outline: 2px solid var(--brand); }
.fsendbar { margin-top: 10px; }

/* Customer page: file groups and PDF previews */
.portfold { margin: 14px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.portfold:first-of-type { margin-top: 4px; }
.portfile img.pfthumb { object-fit: cover; object-position: top; background: #fff; }

/* Commission statement: per-line status */
.doc .ctable td.cstate { white-space: nowrap; width: 1%; }
.doc .ctable td.cstate .btn { display: inline-flex; margin: 0 0 0 4px; vertical-align: middle; }
.doc .ctable td.cstate .chip { vertical-align: middle; }
/* room for the description: compact date, amount and % boxes */
.doc .ctable input[type=date] { width: 128px; max-width: 128px; min-width: 0; }
.doc .ctable input.n { width: 82px; max-width: 82px; min-width: 0; }
.doc .ctable select[data-f=pct] { width: 72px; max-width: 72px; min-width: 0; }
.doc .ctable select[data-f=type] { width: 100%; min-width: 170px; }
.doc .ctable input[data-f=note] { width: 100%; min-width: 170px; }

/* the statement table never runs past the page */
.doc.comm .ctable { width: 100%; }
.doc.comm .ctable td, .doc.comm .ctable th { padding-left: 4px; padding-right: 4px; }

/* Home: commissions requested */
.paycard.commreq { border-left-color: #f79009; }

/* Lead page › Correspondence: date with the type under it, then the subject */
.corrtbl td { vertical-align: top; padding-top: 8px; padding-bottom: 8px; }
.corrtbl td.corrwhen { white-space: nowrap; width: 1%; padding-right: 14px; }
.corrtbl td.corrsub { word-break: normal; overflow-wrap: anywhere; }
.corrtbl td.num { width: 1%; }

.c-mail .mailpick { max-width: 260px; }

/* Lead page: the Customer page card lines up with the other cards (full width) */
.propbar.portbar { max-width: none; margin: 0 0 14px; }

/* Document requests (staff panel and customer upload box) */
.reqpanel { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel2); }
.reqlist { margin-top: 6px; }
.reqrow { display: flex; align-items: center; gap: 10px; padding: 4px 0; flex-wrap: wrap; }
.reqrow > span:first-child { min-width: 180px; }
.upbox .uprow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.upbox .uprow:first-of-type { border-top: 0; }
.upbox .upok { color: var(--ok); font-weight: 600; }

/* Header: search everything */
.gsw { position: relative; }
.gsw input { width: 280px; max-width: 34vw; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); color: var(--ink); font: inherit; font-size: 13px; }
.gsw input:focus { outline: 2px solid var(--brand); outline-offset: 0; }
.gsr { position: absolute; right: 0; top: calc(100% + 6px); width: 420px; max-width: 92vw; max-height: 70vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 50; padding: 4px; }
.gsr .gsi { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; font: inherit; }
.gsr .gsi b { display: block; font-size: 14px; }
.gsr .gsi .muted { display: block; }
.gsr .gsi.on, .gsr .gsi:hover { background: var(--brand-soft); }
.gsr .gsic { font-size: 18px; width: 22px; text-align: center; }
.gsr .gsnone { padding: 12px; }
@media (max-width: 760px) {
  .gsw input { width: 130px; max-width: 40vw; }
  .gsr { position: fixed; left: 8px; right: 8px; top: 64px; width: auto; }
}

/* Proposal: monthly payment estimate under the total */
.doc .dfin { margin: 6px 0 4px; }
.doc .dfinrow { display: flex; justify-content: space-between; gap: 12px; padding: 6px 8px; border: 1px dashed #b9c4cc; border-radius: 6px; font-size: 13px; }
.doc .dfin .dfine { margin-top: 4px; font-size: 10.5px; }

/* Stage checklist: items ticked by the app (photo or survey in Files) */
.stagechk label.auto { cursor: default; }
.stagechk label.auto::after { content: "auto"; font-size: 10px; text-decoration: none; display: inline-block; margin-left: 2px; padding: 0 5px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); }

/* Appointments: the Done tag is a button (tap to undo) */
.chipbtn { border: 0; cursor: pointer; font: inherit; }
.chipbtn:hover { filter: brightness(1.1); }

/* Lead page: contact buttons, tabs, summary */
.contactbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -6px 0 12px; }
.contactbar .btn { font-weight: 600; }
.contactbar .ctinfo { margin-left: 4px; }
.calllog { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.jobtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 4px 0 16px; overflow-x: auto; scrollbar-width: none; position: sticky; top: 0; z-index: 4; background: var(--bg); }
.jobtabs button { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 10px 14px; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.jobtabs button:hover { color: var(--ink); }
.jobtabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.jobtabs .jtn { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 9px; background: var(--panel2); color: var(--muted); font-size: 11px; line-height: 18px; text-align: center; }
.tabgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; align-items: start; }
.sumkv { grid-template-columns: 130px 1fr; row-gap: 6px; }
.sumkv a { color: var(--brand); text-decoration: none; }
.rmsg { padding: 8px 0; border-top: 1px solid var(--line); }
.rmsg:first-of-type { border-top: 0; }
@media (max-width: 760px) {
  .tabgrid { grid-template-columns: 1fr; }
  .contactbar .btn { flex: 1 1 calc(50% - 8px); justify-content: center; }
  .contactbar .ctinfo { flex-basis: 100%; margin: 0; }
}

/* Home: Today */
.todaycard { margin-bottom: 16px; }
.todayhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.todaychips { display: flex; flex-wrap: wrap; gap: 6px; }
.todaycard .tsec { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; border-left: 0 !important; }
.todaycard .tsec h2 { font-size: 15px; }

/* ---------- Phones: bottom bar, search, + New lead (renderBnav in ui.js) ---------- */
#bnav, .gscancel { display: none; }
.qsheet { position: fixed; inset: 0; z-index: 70; background: rgba(15,23,29,.45); display: flex; align-items: flex-end; justify-content: center; }
.qsbox { background: var(--panel); color: var(--ink); width: 100%; max-width: 560px; border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; box-shadow: 0 -10px 30px rgba(0,0,0,.25); }
.qshead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.qshead h2 { margin: 0; font-size: 18px; }
.qsgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qsgrid .qsw { grid-column: 1 / -1; }
.qsgrid .fld { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.qsgrid input, .qsgrid select, .qsgrid textarea { font: inherit; font-weight: 400; font-size: 16px; padding: 10px 12px; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); color: var(--ink); width: 100%; box-sizing: border-box; }
.qsgrid textarea { min-height: 64px; resize: vertical; }
.qssave { width: 100%; justify-content: center; min-height: 50px; font-size: 16px; margin-top: 4px; }
@media (min-width: 621px) { .qsheet { align-items: center; } .qsbox { border-radius: 16px; } }
@media (max-width: 620px) {
  #bnav { display: block; }
  .bnbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.06); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .bnb { all: unset; flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; border-radius: 10px; -webkit-tap-highlight-color: transparent; }
  .bnb svg { width: 22px; height: 22px; }
  .bnb.on { color: var(--brand); }
  .bnb.on svg { stroke-width: 2.4; }
  .bnb:active { background: var(--brand-soft); }
  .fab { position: fixed; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 41; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--brand); color: var(--on-brand); font-size: 30px; line-height: 1; font-weight: 400; box-shadow: 0 6px 18px rgba(0,0,0,.25); cursor: pointer; display: grid; place-items: center; padding: 0 0 3px; }
  .fab:active { transform: scale(.95); }
  body.signmode #bnav, body.authmode #bnav { display: none; }
  main { padding-bottom: calc(84px + env(safe-area-inset-bottom)) !important; }
  body.signmode main { padding-bottom: 60px !important; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); }
  .env-test body::after { right: auto; left: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); font-size: 10px; padding: 3px 6px; opacity: .85; }
  /* top: just WetEdge and the company; search lives in the bottom bar */
  header { flex-wrap: nowrap !important; align-items: center !important; }
  .hdr-right { width: auto !important; margin-left: auto; }
  header .gsw { display: none; }
  span.viewas { display: none; }
  label.viewas .vatxt { display: none; }
  label.viewas select { font-size: 12px; max-width: 130px; }
  .hdr-who .co span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.gsopen header .gsw { display: flex; gap: 8px; align-items: center; position: fixed; top: 0; left: 0; right: 0; z-index: 60; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: var(--panel); box-shadow: 0 4px 16px rgba(0,0,0,.15); }
  body.gsopen .gsw input { width: auto; max-width: none; flex: 1; font-size: 16px; min-height: 44px; }
  body.gsopen .gscancel { display: inline-flex; min-height: 44px; }
  body.gsopen .gsr { top: calc(66px + env(safe-area-inset-top)); bottom: calc(70px + env(safe-area-inset-bottom)); max-height: none; }
  .gsr .gsi { min-height: 48px; }
  /* the page list opens as a sheet above the bar */
  #nav .navtoggle { display: none !important; }
  #nav:not(.open) { display: none !important; }
  #nav.open { position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 39; max-height: calc(100vh - 140px); overflow: auto; background: var(--panel); border-radius: 16px 16px 0 0; padding: 10px 10px 14px; display: grid !important; grid-template-columns: 1fr 1fr; gap: 4px; box-shadow: 0 0 0 100vmax rgba(15,23,29,.4); flex-wrap: initial; }
  #nav.open > button:not(.navtoggle) { display: flex !important; min-height: 48px; }
  #nav.open .navnote { grid-column: 1 / -1; display: block; margin: 8px 4px 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; }
  #nav.open .navnote .btn { min-height: 40px; }
  .mobfoot { margin-bottom: 8px; }
}
@media print { #bnav, .qsheet { display: none !important; } }

/* ---------- Next step (nextStep in stages.js) ---------- */
.nstep { display: inline-block; font-size: 12px; color: var(--ink); background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; line-height: 1.5; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.nstep b { font-weight: 600; }
.nstep.due { border-color: var(--brand); background: var(--brand-soft); }
.nstep.late { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: var(--danger-soft); color: var(--danger); }
.nstep.sm { margin-top: 6px; font-size: 11.5px; display: block; width: fit-content; }
.lt-next { max-width: 240px; }
.nsrow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 4px; font-size: 13px; }
.nsrow .nswhen { color: var(--muted); }
.nsrow .nswhen.late { color: var(--danger); font-weight: 600; }
.nsrow .nsbtns { margin-left: 4px; }
.nsedit { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-width: 460px; }
.nsedit .f { min-height: 38px; }
@media (max-width: 620px) {
  table.leadtbl td.lt-next { order: 3; width: 100%; max-width: none; padding-top: 2px; }
  table.leadtbl td.lt-next:empty { display: none; }
}

/* ---------- Clearer buttons ----------
   One solid main button per card; the other buttons are lighter (no fill, brand text) so the main one stands out. */
.card .btn:not(.primary):not(.danger):not(.on):not(:disabled) { background: transparent; color: var(--brand); border-color: color-mix(in srgb, var(--brand) 22%, var(--line)); }
.card .btn:not(.primary):not(.danger):not(.on):not(:disabled):hover { background: var(--brand-soft); }
.card .btn.primary { box-shadow: 0 1px 2px rgba(16,24,40,.12); }
.doc .btn, .signmode .card .btn:not(.primary) { color: inherit; }
/* Finger-sized on phones */
@media (max-width: 620px) and (pointer: coarse) {
  .btn { min-height: 44px; font-size: 14px; }
  .btn.sm { min-height: 40px; font-size: 13px; padding-left: 12px; padding-right: 12px; }
  .chip { padding-top: 3px; padding-bottom: 3px; }
  input[type=checkbox] { width: 24px; height: 24px; }
  a.btn { align-items: center; }
}

/* ---------- Empty lists ---------- */
.empty { padding: 34px 20px; font-size: 14px; line-height: 1.5; }
.empty::before { content: ''; display: block; width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 50%; background: var(--brand-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a6a84' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 15c2.5-2 5-2 7.5 0s5 2 7.5 0 2.5-1.5 3-1'/%3E%3Cpath d='M3 10c2.5-2 5-2 7.5 0s5 2 7.5 0 2.5-1.5 3-1' opacity='.5'/%3E%3C/svg%3E") center / 24px no-repeat; }
.empty .btn { margin-top: 12px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 2px; }

/* ---------- Customer pages: header, pinned Approve / Sign bar, phone sizes ---------- */
.sghead { align-items: center; padding: 10px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.sgbrand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sgbrand b { font-size: 16px; }
.sgbrand .muted { font-size: 13px; }
.sghead .portlogo { height: 40px; max-width: 120px; object-fit: contain; margin: 0; }
.sghead a.btn { text-decoration: none; }
.porthero { margin: -16px -16px 14px; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; max-height: 260px; background: var(--panel2); }
.porthero img { display: block; width: 100%; height: 260px; object-fit: cover; }
.signfab { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(0,0,0,.08); transition: transform .2s ease; }
.signfab.gone { transform: translateY(110%); }
.signfab .sftot small { display: block; font-size: 12px; color: var(--muted); }
.signfab .sftot b { font-size: 18px; }
.signfab .btn { min-height: 48px; padding: 0 22px; font-size: 16px; text-decoration: none; justify-content: center; }
@media (min-width: 900px) { .signfab { left: 50%; right: auto; transform: translateX(-50%); width: 860px; border-radius: 14px 14px 0 0; border: 1px solid var(--line); } .signfab.gone { transform: translate(-50%, 110%); } }
body.signmode main { padding-bottom: 96px; }
@media (max-width: 620px) {
  body.signmode main { padding: 10px 12px 96px; font-size: 16px; }
  .signintro p, .portcard p, .signcard p, .portsteps li, .signagree { font-size: 16px; line-height: 1.5; }
  .signintro h2, .signcard h2, .signdone h2 { font-size: 22px; line-height: 1.25; }
  .portcard h2 { font-size: 19px; }
  .signintro .btn, .portcard .btn, .sghead .btn { min-height: 46px; font-size: 15px; }
  .sghead { flex-wrap: wrap; }
  .sghead .sgbtns { width: 100%; }
  .sghead .sgbtns .btn { flex: 1; justify-content: center; }
  .porthero img { height: 200px; }
  .signopt { padding: 14px 12px; font-size: 15px; }
}
@media print { .signfab { display: none !important; } }
.nstep { white-space: normal; border-radius: 10px; text-align: left; }
.lt-next { min-width: 170px; }
@media (max-width: 620px) {
  .naitem, .furow { flex-wrap: wrap; }
  .naitem > .u-flex-1, .furow > .u-flex-1 { flex: 1 1 100%; min-width: 0; }
  .naitem > .u-row, .furow > .furow-b { flex: 1 1 100%; justify-content: flex-start; }
}
.linkbtn { all: unset; color: var(--brand); text-decoration: underline; cursor: pointer; font-size: inherit; }
.dupnote { display: flex; flex-direction: column; gap: 6px; }
.dupnote .duphead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dupnote .duphead .btn { margin-left: auto; }
.dupnote .duprow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid color-mix(in srgb, currentColor 15%, transparent); }
/* Lead › Details: one column on smaller screens, Contact right under Customer, Builder last */
@media (max-width:1000px) {
  .detail.jdet > .stack { display: contents; }
  .jdet .c-customer { order: 1; } .jdet .c-contact { order: 2; } .jdet .c-job { order: 3; } .jdet .c-site { order: 4; } .jdet .c-builder { order: 5; }
}
.qlmatch:empty { display: none; }
.qlmatch { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.qlm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; background: var(--warn-soft); font-size: 13px; }
.qlm.on { background: var(--ok-soft); }
.search .sclear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); font-size: 15px; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; }
.search .sclear:hover { background: var(--brand-soft); color: var(--ink); }
.search input { padding-right: 38px; }
.notice.listfilt { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }

/* ---------- Pre-qualifying (stages.js qualForm / qualBadge) ---------- */
.qgroup { margin-top: 12px; }
.qgh { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.qform .qwide { grid-column: 1 / -1; }
.qform .qwide2 { grid-column: span 2; }
@media (max-width: 620px) { .qform .qwide2 { grid-column: 1 / -1; } }
.qtip { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--brand-soft); font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.qtip .stmsg { margin-left: auto; }
.qresult { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.qresult.qok { background: var(--ok-soft); color: var(--ok); }
.qresult.qno { background: var(--warn-soft); color: var(--warn); }
.qresult .qflags { display: block; margin-top: 3px; color: var(--ink); }
.chip.qbadge.qok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.chip.qbadge.qno { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.chip.qbadge.sm { padding: 0 6px; font-size: 11px; }
.qhint { margin-top: 6px; font-size: 12px; color: var(--muted); }
/* Pipeline cards: next step on one line, ✓ stays beside the name */
.nstep.sm { display: block; width: auto; max-width: 100%; border-radius: 8px; padding: 4px 8px; margin-top: 6px; line-height: 1.35; }
.nstep.sm b, .nstep.sm .nst { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ppcard .qbadge.sm { white-space: nowrap; vertical-align: 1px; }
.ppcard b + .qbadge { margin-left: 2px; }
/* Pipeline (computers / iPads): busy columns share the width, empty ones shrink, so every stage fits */
@media (min-width: 621px) {
  .ppboard { display: flex; align-items: flex-start; }
  .ppcol { flex: 1 1 0; min-width: 160px; }
  .ppcol.ppnone { flex: .45 1 0; min-width: 96px; min-height: 90px; }
  .ppcol.ppnone .pphead b { white-space: normal; }
}

/* ---------- Assigning leads ---------- */
.navbadge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }
.bnb { position: relative; }
.bnb .navbadge { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 18px; font-size: 11px; }
select.assignsel { min-width: 140px; max-width: 190px; padding: 4px 8px; font-size: 13px; }
.newcard { border-left: 4px solid var(--danger); }
.unascard { border-left: 4px solid var(--warn); }
@media (max-width: 620px) { td.lt-sp { width: 100%; } select.assignsel { max-width: none; width: 100%; } }
table.t-appts select.appttype { min-width: 190px; width: auto; max-width: none; }
.sumkv .sitenotes { white-space: pre-wrap; }

/* ---------- Sales reports (reports.js rpSources / rpScore / rpSpeed / rpUpgrades) ---------- */
table.rptable { width: 100%; }
table.rptable th { font-size: 12px; white-space: nowrap; }
table.rptable td { white-space: nowrap; }
table.rptable tr.rptot td { border-top: 2px solid var(--line); font-weight: 600; }
.rpgood { color: var(--ok); }
.rpbad { color: var(--danger); }
.mkted { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 10px 0 12px; display: flex; flex-direction: column; gap: 10px; }
.mkted label.u-fs-12 { display: flex; align-items: center; gap: 8px; }
.mkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 12px; }
.mkgrid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.mkgrid input { color: var(--ink); }
.rpspeed { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; }
/* report tables: rows padded like the headings so the columns line up */
table.rptable th, table.rptable td { padding: 9px 14px; }
table.rptable th { text-align: left; }
table.rptable th.num, table.rptable td.num { text-align: right; }
table.rptable tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--panel2) 60%, transparent); }
/* Reports: smaller cards fill any gap left beside a full-width one */
.rpgrid { grid-auto-flow: row dense; }

/* ---------- Install WetEdge card (ui.js installCard) ---------- */
.installcard { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border-left: 4px solid var(--brand); }
.installcard h2 { margin: 0 0 2px; font-size: 16px; }
.installcard .instic svg, .installcard .instic img { width: 44px; height: 44px; border-radius: 10px; }
.iossteps { margin: 8px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.6; }
.shareic { display: inline-block; padding: 0 5px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
@media (max-width: 620px) { .installcard .instbtns { width: 100%; } .installcard .instbtns .btn { flex: 1; justify-content: center; } }
/* Phones: leave room for the company name; estimate buttons without their captions */
@media (max-width: 620px) {
  header .brand small { display: none; }
  header .savebadge { padding: 2px 6px; font-size: 11px; }
  .pagehead .actions .btncap > span { display: none; }
  .pagehead .actions .btncap { display: contents; }
  .pagehead .actions { gap: 8px; }
}
.dupnote.dupmini { padding-top: 8px; padding-bottom: 8px; }
.dupnote .duphead .btn + .btn { margin-left: 0; }

/* Settings › Data: Start fresh */
.sfcard { border-left: 4px solid var(--danger); }
.sfcols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; margin: 10px 0 12px; font-size: 13px; }
.sfcols ul { margin: 6px 0 0; padding-left: 18px; }
.sfcols li { margin: 3px 0; }
.sfopt { display: flex; gap: 8px; align-items: center; margin: 6px 0; font-size: 14px; }
.sfname { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; font-size: 13px; }
.sfname input { max-width: 360px; }
@media (max-width: 620px) { .sfcols { grid-template-columns: 1fr; } }
