/* One stylesheet for phone and computer.
   Phone (narrow): bottom tabs, full-width cards, big tap targets.
   Computer (900px+): the same menu becomes a side bar; content gets a comfortable width. */

:root {
  --navy: #14365d;
  --navy-2: #1f4a7a;
  --blue: #1d5fd1;
  --blue-soft: #e7effc;
  --amber: #f59e0b;
  --amber-soft: #fff4dc;
  --green: #15803d;
  --green-soft: #e3f5e9;
  --red: #c62828;
  --red-soft: #fdecec;
  --ink: #17202b;
  --muted: #5d6877;
  --line: #dde2e9;
  --bg: #f4f6f9;
  --card: #ffffff;
  --radius: 14px;
  --tap: 52px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; font-size: 17px; line-height: 1.4; }
a { color: var(--blue); }
h1, h2 { margin: 0; }
small { font-size: 0.85em; }
.muted { color: var(--muted); }
.icon { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */

.view { padding: 0 16px calc(var(--nav-h) + var(--safe-b) + 24px); max-width: 760px; margin: 0 auto; outline: none; }
body:not(.signed-in) .view { padding-bottom: 24px; }
body:not(.signed-in) .nav { display: none; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b); height: calc(var(--nav-h) + var(--safe-b));
}
.nav-brand { display: none; }
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; min-height: var(--nav-h);
}
.nav-item .icon { width: 26px; height: 26px; }
.nav-item.active { color: var(--navy); }
.nav-item.active .icon { stroke-width: 2.4; }
.desktop-only { display: none !important; }

@media (min-width: 900px) {
  body { font-size: 16px; }
  .nav {
    top: 0; right: auto; width: 230px; height: auto; flex-direction: column; border-top: 0;
    border-right: 1px solid var(--line); padding: 16px 12px; gap: 4px; background: var(--navy);
  }
  .nav-brand { display: block; color: #fff; font-weight: 700; font-size: 18px; padding: 8px 12px 20px; }
  .nav-item {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px;
    min-height: 46px; border-radius: 10px; font-size: 15px; color: #c9d6e6;
  }
  .nav-item:hover { background: var(--navy-2); color: #fff; }
  .nav-item.active { background: #fff; color: var(--navy); }
  .desktop-only { display: flex !important; }
  body.signed-in .view { margin-left: 230px; max-width: 980px; padding: 8px 40px 40px; }
  .contact-bar { max-width: 520px; }
  .form { max-width: 560px; }
}

/* ---------- Page header ---------- */

.page-header {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; align-items: center; gap: 8px; padding: 14px 0 10px;
  padding-top: max(14px, env(safe-area-inset-top));
}
.page-header h1 { flex: 1; font-size: 24px; line-height: 1.15; overflow-wrap: anywhere; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border-radius: 12px; color: var(--ink); background: transparent; border: 0;
}
.icon-btn:active { background: var(--line); }
.icon-btn.flip .icon { transform: rotate(180deg); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px; border-radius: 12px; border: 0;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:active { background: #154aa6; }
.btn-secondary { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); }
.btn-danger { background: var(--card); color: var(--red); border: 1.5px solid #f1c4c4; }
.btn-small { min-height: 42px; padding: 0 14px; font-size: 15px; }
.btn-small .icon { width: 18px; height: 18px; }
.btn-block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.actions .btn { flex: 1 1 140px; }

.contact-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; margin: 6px 0 14px; }
.contact-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 68px; border-radius: var(--radius); background: var(--navy); color: #fff;
  text-decoration: none; font-weight: 650; font-size: 15px;
}
.contact-btn .icon { width: 26px; height: 26px; }
.contact-btn:active { background: var(--navy-2); }

/* ---------- Status pills ---------- */

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: var(--line); color: var(--ink); white-space: nowrap;
}
.lead-new { background: var(--amber); color: #3b2500; }
.lead-attempted { background: var(--amber-soft); color: #7a4b00; }
.lead-contacted, .lead-estimated { background: var(--blue-soft); color: var(--blue); }
.lead-converted, .job-done { background: var(--green-soft); color: var(--green); }
.lead-lost, .job-canceled { background: var(--red-soft); color: var(--red); }
.job-unscheduled { background: var(--amber-soft); color: #7a4b00; }
.job-scheduled { background: var(--blue-soft); color: var(--blue); }
.job-done_pending_approval { background: #efe7fb; color: #5b2ca0; }

/* ---------- Lists and cards ---------- */

.list { display: flex; flex-direction: column; gap: 10px; }
.card {
  display: block; padding: 14px 16px; background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--line); color: inherit; text-decoration: none; border-left: 5px solid var(--line);
}
.card:active { background: #f9fafc; }
.card.is-new { border-left-color: var(--amber); box-shadow: 0 1px 0 rgba(245, 158, 11, 0.25); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-top strong { font-size: 17px; }
.card-desc { margin: 4px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { color: var(--muted); }
.card-wrap { position: relative; }
.card-wrap.has-action .card { padding-right: 112px; }
.card-wrap .card-action { position: absolute; right: 12px; bottom: 12px; }

.group-title { font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 22px 0 8px; }
.group-title.new-title, .group-title.attention { color: #9a5b00; }
.empty { color: var(--muted); padding: 10px 0; }
.empty.small { padding: 4px 0; font-size: 15px; }

.segmented { display: flex; background: #e7ebf0; padding: 4px; border-radius: 12px; margin: 4px 0 6px; }
.segmented a {
  flex: 1; text-align: center; padding: 10px 0; border-radius: 9px; text-decoration: none;
  color: var(--muted); font-weight: 650;
}
.segmented a.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

/* ---------- Detail pages ---------- */

.detail-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.description { font-size: 18px; margin: 8px 0; white-space: pre-wrap; }
.when { font-weight: 700; font-size: 18px; margin: 4px 0; }
.notice { background: var(--amber-soft); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 14px 0; padding: 14px 16px; background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.link-row { display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.row-link { display: flex; justify-content: space-between; align-items: center; min-height: var(--tap); padding: 0 16px; text-decoration: none; color: var(--ink); font-weight: 600; }
.row-link + .row-link { border-top: 1px solid var(--line); }
.row-link .icon { color: var(--muted); width: 18px; }
.section { margin-top: 22px; }
.section h2, .form h2 { font-size: 18px; margin: 0 0 10px; }
.plain { padding-left: 18px; margin: 0; }
.plain li { margin: 6px 0; }

.notes { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 8px; }
.notes li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.notes p { margin: 0 0 4px; white-space: pre-wrap; }
.notes small { color: var(--muted); }
.note-form { display: flex; flex-direction: column; gap: 8px; }
.note-form .btn { align-self: flex-end; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.tag {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px 10px; border-radius: 999px;
  background: #eef1f5; color: var(--ink); border: 1px solid var(--line); font-size: 13px; font-weight: 600;
  max-width: 100%; overflow-wrap: anywhere;
}
.tags-big .tag { font-size: 15px; padding: 4px 4px 4px 12px; min-height: 40px; }
.tags-big .tag:not(:has(.tag-remove)) { padding-right: 12px; }
.tag-remove {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.tag-remove:active { background: var(--line); }
.tag-form { display: flex; gap: 8px; margin-top: 10px; }
.tag-form input, .tag-form select { flex: 1; min-width: 0; }

.search-box { width: 100%; margin: 4px 0 12px; font-size: 17px; }

/* ---------- Estimate visits ---------- */

.visit-box { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 10px 0; padding: 12px 14px; border-radius: var(--radius); background: var(--blue-soft); border: 1px solid #c9d9f5; }
.visit-box b { font-size: 17px; }
.visit-box.past { background: #eef1f5; border-color: var(--line); }
.visit-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.visit-actions .btn { flex: 1 1 auto; }
.visit-book { margin: 10px 0; }
.send-to-tech { margin: 10px 0; }
.to-tech-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.to-tech-actions .btn { flex: 1 1 200px; }
.to-tech-actions .hint { flex-basis: 100%; }
.visit-box.unpaid { background: var(--red-soft); border-color: #f1c4c4; }
.visit-box .visit-fee { font-size: 15px; }
.visit-box .ok { color: var(--green); }
.visit-box .bad { color: var(--red); }
.visit-box .invite-box { flex-basis: 100%; }
.unpaid-warning { display: block; width: 100%; margin: 6px 0 0; padding: 8px 10px; border-radius: 10px;
  background: var(--red); color: #fff; font-weight: 800; font-size: 14px; }
.cal-item.cal-visit.cal-unpaid .cal-body { border-left-color: var(--red); }
.cal-body .unpaid-warning { white-space: normal; overflow: visible; text-overflow: clip; display: block; }
.paid-fields { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.discount-desc { margin: -4px 0 12px; }
.pay-ways li { font-size: 18px; margin: 8px 0; }
.write-estimate { margin: 10px 0 0; min-height: 56px; font-size: 18px; }
.pill.visit { background: #e0f2f1; color: #0f766e; }
.cal-item.cal-visit .cal-body { border-left: 4px solid #14b8a6; padding-left: 10px; }

/* ---------- Estimates ---------- */

.est-unsent { background: var(--line); }
.est-sent { background: var(--blue-soft); color: var(--blue); }
.est-approved { background: var(--green-soft); color: var(--green); }
.est-rejected { background: var(--red-soft); color: var(--red); }
.est-canceled { background: var(--line); color: var(--muted); text-decoration: line-through; }

.est-line {
  display: flex; flex-direction: column; gap: 8px; margin: 0 0 10px; padding: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0;
}
.est-line-top { display: flex; gap: 8px; align-items: center; }
.est-line-top input { flex: 1; min-width: 0; font-weight: 600; }
/* Qty | Price (narrow) | [Taxable] | the line's total (read-only), on one row. */
.est-line-nums { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(90px, auto); gap: 8px; align-items: end; }
.est-line.with-tax .est-line-nums { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) auto minmax(90px, auto); }
textarea[data-autogrow] { resize: none; overflow: hidden; min-height: 44px; line-height: 1.35; }
.line-picker { margin: 4px 0 8px; }
.line-picker > summary { list-style: none; }
.line-picker > summary::-webkit-details-marker { display: none; }
.line-picker[open] > summary { margin-bottom: 8px; }
.line-picker .choice-btn { justify-content: space-between; }
.deposit-row { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; }
.deposit-row label { font-weight: 700; margin: 0; }
.deposit-row select { width: 96px; flex: none; }
.deposit-row input { width: 110px; flex: none; }
.est-line-nums label { font-size: 14px; }
.est-line-total { text-align: right; font-weight: 700; align-self: center; padding-top: 22px; white-space: nowrap; }
.est-line-top .line-remove { color: var(--muted); }
.est-line-top .line-remove:hover { color: var(--red); }
label.check.small { font-size: 14px; display: flex; align-items: center; gap: 6px; min-height: 52px; }
label.check.small input { width: 22px; height: 22px; min-height: 22px; }

.est-totals { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
.est-totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.est-totals .grand { font-size: 20px; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; }

.est-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 12px 0; overflow: hidden; }
.est-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.est-table .num { text-align: right; white-space: nowrap; }
.est-table tfoot td { border-bottom: 0; padding-top: 6px; padding-bottom: 6px; }
.est-table tr.total td { font-weight: 800; font-size: 19px; border-top: 2px solid var(--line); }

.notice.ok { background: var(--green-soft); }
.inv-draft { background: var(--line); }
.inv-sent { background: var(--blue-soft); color: var(--blue); }
.inv-partially_paid { background: var(--amber-soft); color: #7a4b00; }
.inv-paid { background: var(--green-soft); color: var(--green); }
.est-table tr.credit td { color: var(--green); }
.credits { margin: 6px 0; color: var(--green); }
.balance { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; margin: 6px 0 12px;
  border-radius: var(--radius); background: var(--amber-soft); font-size: 18px; }
.balance b { font-size: 22px; }
.balance.paid { background: var(--green-soft); }
.payments { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 8px; }
.payments li { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.choice-list.row { flex-direction: row; flex-wrap: wrap; }
.choice-list.row .choice { flex: 1 1 90px; }
.signature-img { display: block; max-width: 100%; width: 320px; background: #fff; border: 1px solid var(--line); border-radius: 12px; margin: 8px 0 12px; }

/* The client's page: no app menu, plain and trustworthy. */
.public-page { max-width: 680px; margin: 0 auto; padding: 20px 16px 48px; }
.public-head { padding: 6px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px; font-size: 18px; }
.public-page h1 { margin: 10px 0 4px; }
.sig-wrap { position: relative; }
.sig-pad {
  display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; touch-action: none;
  background: #fff; border: 2px dashed #b9c2cf; border-radius: 12px; cursor: crosshair;
}
.sig-wrap .btn { position: absolute; right: 8px; top: 8px; }
.reject-box { margin-top: 18px; }
.reject-box summary { cursor: pointer; color: var(--muted); padding: 10px 0; }

.tech-row {
  display: flex; flex-direction: column; gap: 10px; margin: 0 0 12px; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0;
}

.upload-row { display: flex; flex-wrap: wrap; gap: 10px; }
.upload-btn { flex: 1 1 160px; }
.upload-status { color: var(--muted); min-height: 1.2em; margin: 6px 0; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #e7ebf0; display: block; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-tag { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,0.65); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.file-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; padding: 8px; gap: 6px; color: var(--muted); font-size: 12px; text-align: center; overflow-wrap: anywhere; }

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; }
.form.narrow { max-width: 480px; }
.form h2 { margin-top: 10px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 15px; }
input, select, textarea {
  font: inherit; font-size: 17px; font-weight: 400; color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: var(--tap); width: 100%;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(29, 95, 209, 0.25); border-color: var(--blue); }
input[readonly] { background: #eef1f5; }
label.check { flex-direction: row; align-items: center; gap: 10px; }
label.check input { width: 24px; min-height: 24px; height: 24px; }
fieldset { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
legend { font-weight: 700; padding: 0 6px; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.hint { color: var(--muted); font-size: 15px; margin: 0; }
.form-error { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 10px 14px; margin: 0; font-weight: 600; }

.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice {
  flex-direction: row; align-items: center; gap: 12px; min-height: var(--tap); padding: 10px 14px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; font-weight: 500; font-size: 17px;
  text-align: left; cursor: pointer; color: inherit; font-family: inherit; width: 100%;
}
.choice input { width: 22px; min-height: 22px; height: 22px; margin: 0; flex: none; }
.choice:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.choice-btn:active { background: var(--blue-soft); }
.new-client-toggle summary { list-style: none; }
.new-client-toggle summary::-webkit-details-marker { display: none; }
.new-client-toggle[open] summary { display: none; }
[data-client-results] { margin-bottom: 4px; }
.picked { display: flex; flex-direction: column; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.picked .new-address { display: none; }
.picked:has(input[name=addressId][value=new]:checked) .new-address { display: flex; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700; flex: none; }
.avatar.big { width: 56px; height: 56px; font-size: 20px; }

/* ---------- Calendar ---------- */

.cal-nav { display: flex; align-items: center; justify-content: space-between; margin: 8px 0; }
.cal-day { margin-bottom: 6px; }
.cal-day.today .group-title { color: var(--blue); }
.cal-item { display: flex; align-items: stretch; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 8px; }
.cal-time { width: 82px; flex: none; font-weight: 700; display: flex; flex-direction: column; white-space: nowrap; }
.cal-time small { color: var(--muted); font-weight: 500; }
.cal-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; color: inherit; text-decoration: none; }
.cal-body .pill { align-self: flex-start; }
.cal-body span:not(.pill):not(.unpaid-warning) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-go { background: var(--blue-soft); color: var(--blue); align-self: center; width: 52px; height: 52px; }

/* ---------- Sign in ---------- */

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px 0; }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 18px; padding: 28px 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 6px 30px rgba(20, 54, 93, 0.1); }
.auth-card h1 { font-size: 26px; }
.auth-card p { margin: 0; }

/* ---------- Me, team, messages ---------- */

.me-card { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 8px 0 16px; }
.message-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.message-box p { margin-top: 0; }
.message-preview { white-space: pre-wrap; font-family: inherit; background: #eef1f5; border-radius: 10px; padding: 12px; margin-top: 12px; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.table th { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: #f8f9fb; }
.table tr.off td { color: var(--muted); }
.invite-box { background: var(--blue-soft); border-radius: var(--radius); padding: 16px; }
.invite-box p { margin-top: 0; }
.link-input { font-family: ui-monospace, Menlo, monospace; font-size: 14px; }

.toast {
  position: fixed; left: 50%; transform: translate(-50%, 20px); bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 20; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); }
@media (min-width: 900px) { .toast { left: calc(50% + 115px); bottom: 24px; } }

/* ---------- Job changes and payments ---------- */

.apply-box { border: 2px solid #e0a100; }
.apply-box p { margin: 0 0 8px; }
.apply-box .actions { flex-wrap: wrap; }
.payments li.deleted { opacity: 0.6; }
.payments li.deleted b { text-decoration: line-through; }
details.replaced { margin-top: 12px; }
details.replaced summary { cursor: pointer; color: var(--muted); padding: 8px 0; }
details.replaced .est-table { opacity: 0.7; }

/* Take payment */
details.take-payment { margin: 8px 0 12px; }
details.take-payment > summary { list-style: none; }
details.take-payment > summary::-webkit-details-marker { display: none; }
details.take-payment[open] > summary { margin-bottom: 10px; }
details.take-payment .choice-btn[disabled] { opacity: 0.55; cursor: not-allowed; justify-content: space-between; }
details:is(.cash-choice, .card-choice) > summary { list-style: none; justify-content: space-between; }
details:is(.cash-choice, .card-choice) > summary::-webkit-details-marker { display: none; }
details:is(.cash-choice, .card-choice)[open] > summary { border-color: var(--blue); background: var(--blue-soft); }
details:is(.cash-choice, .card-choice) .form { margin-top: 10px; }
.card-choice .form .btn + .btn { margin-top: 8px; }
.pay-card { margin: 12px 0; }
.card-pay .card-element { margin: 14px 0; padding: 12px; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 12px; min-height: 120px; }
.card-pay .pay-summary { margin: 12px 0; }
.card-pay .est-totals .total { font-weight: 700; }
.deposit-step { margin: 16px 0; display: grid; gap: 10px; }
.save-card-notice { font-size: 13px; }
.pill.est-signed { background: #fdf1d9; color: #8a5a00; }
.dep-method { margin: 4px 0 12px; }
.est-photos { margin: 12px 0; }
.addr-field { position: relative; }
.addr-suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin-top: -8px; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.15); overflow: hidden; }
.addr-suggest-head { margin: 0; padding: 8px 14px 4px; font-size: 13px; color: var(--muted, #666); }
.addr-option { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 52px; padding: 10px 14px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; font: inherit; cursor: pointer; color: inherit; }
.addr-option:hover, .addr-option:focus { background: var(--line); outline: none; }
.addr-option small { color: var(--muted, #666); font-size: 13px; }
.est-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 8px 0; }
.est-photo { margin: 0; }
.est-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; display: block; background: var(--line); }
.est-photo figcaption { font-size: 14px; margin-top: 4px; display: flex; justify-content: space-between; align-items: center; }
.upload-btn { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.est-terms h2 { font-size: 16px; margin: 14px 0 4px; }
details.desc-edit > summary { list-style: none; display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
details.desc-edit > summary::-webkit-details-marker { display: none; }
details.desc-edit > summary .description { flex: 1; margin: 0; }
.desc-edit-btn { flex: none; color: var(--blue); font-weight: 600; font-size: 14px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 8px; }
details.desc-edit[open] > summary { display: none; }
details.desc-edit .form { margin: 4px 0 12px; }
.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg-btn { flex: 1; min-height: 46px; border: 0; background: var(--card); font: inherit; font-weight: 600; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.on { background: var(--blue); color: #fff; }
.take-payment .pay-choice { justify-content: center; text-align: center; }
details.take-payment .choice-btn.pay-choice[disabled] { justify-content: center; }
details:is(.cash-choice, .card-choice) > summary.pay-choice { justify-content: center; }

/* Job money at a glance; estimates that no longer count */
.money-line { margin: 6px 0 2px; }
.money-line .paid-tag { color: var(--green); font-weight: 700; }
.money-line .owed-tag { color: var(--red); font-weight: 600; }
.money-line .warn { color: var(--red); }
.card.not-counted .amount { text-decoration: line-through; }
.card .on-job { display: block; margin-top: 2px; }
.card.not-counted .on-job { color: var(--red); }

/* Set Commission */
.commission-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--card); border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
fieldset.commission-pick { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; }
fieldset.commission-pick legend { font-weight: 700; padding: 0 4px; }
.commission-value { margin-top: 10px; }

/* Tech name chips (color per person, from Settings) */
.tech-chip { display: inline-block; color: #fff; background: #5f6b76; border-radius: 999px; padding: 2px 10px;
  font-size: 0.85em; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.tech-chip.none { background: var(--line); color: var(--muted); }
.tech-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.card-techs { margin: 6px 0 2px; }
.cal-techs { display: block; margin: 2px 0; }
fieldset.color-pick { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 0 0 10px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch span { display: block; width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; }
.swatch input:checked + span { border-color: var(--text, #111); box-shadow: 0 0 0 2px #fff inset; }
.swatch input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Notifications-off warnings */
.push-banner { border: 2px solid #e0a100; }
.push-banner .btn { margin-top: 10px; }
small.warn, .warn { color: var(--red); }

/* Reports (computer) */
.report-range { display: inline-flex; align-items: center; gap: 8px; margin: 10px 0; }
.report-range select { width: auto; }
.report-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; margin: 8px 0 18px; }
.report-table th, .report-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.report-table th { font-size: 0.85em; color: var(--muted); font-weight: 600; }
.report-table .num { text-align: right; white-space: nowrap; }
.report-table td.warn { color: var(--red); font-weight: 700; }
.report-tiles { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 18px; }
.report-tiles .tile { background: var(--card); border-radius: 12px; padding: 12px 16px; min-width: 140px; display: flex; flex-direction: column; }
.report-tiles .tile span { color: var(--muted); font-size: 0.85em; }
.report-tiles .tile b { font-size: 1.3em; }

/* Tech report (Reports > Expenses) */
.report-dates { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.report-custom { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 10px 0; }
.report-custom[hidden] { display: none; }
.report-custom label { display: flex; flex-direction: column; font-size: 0.85em; }
.report-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 6px 0 10px; }
.report-filters > label { display: flex; flex-direction: column; font-size: 0.85em; gap: 4px; }
.report-filters select { width: auto; min-width: 170px; }
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin: 0 0 12px; }
details.area-pick, details.fields-pick { position: relative; }
details.area-pick > summary, details.fields-pick > summary { list-style: none; cursor: pointer; }
details.area-pick > summary::-webkit-details-marker, details.fields-pick > summary::-webkit-details-marker { display: none; }
details.area-pick > summary::after, details.fields-pick > summary::after { content: " ▾"; }
.area-list, .field-list { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 220px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex; flex-direction: column; gap: 6px; }
.area-list .check, .field-list .check { display: flex; gap: 8px; align-items: center; font-size: 0.95em; }
.table-scroll { overflow-x: auto; }
.tech-report td, .tech-report th { white-space: nowrap; }
.tech-report td:nth-child(4) { white-space: normal; min-width: 160px; }
.tech-report .totals-row td { background: var(--line); font-weight: 700; }
.tech-report .totals-row td.hl { background: #fff3c4; }
.balance-total { font-size: 1.1em; }
.neg { color: var(--red); }
.pos { color: var(--green); }
.balance-callout { font-size: 1.15em; margin: 4px 0 10px; padding: 10px 14px; border-radius: 12px; background: #fff3c4; display: inline-block; }
.balance-callout.neg b { color: var(--red); }
.balance-callout.pos b { color: var(--green); }

/* Settling (tech report) */
.settle-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 4px 0 10px; }
.settle-bar .balance-callout { margin: 0; }
.settled-tag { color: var(--green); font-weight: 600; }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; cursor: pointer; font: inherit; }

/* Status filter chips (Jobs, Leads, Estimates) */
.status-filter { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 12px; }
.chip-check { position: relative; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-check span { display: inline-block; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  font-size: 0.9em; font-weight: 600; color: var(--muted); }
.chip-check input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip-check input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.cal-tech { display: inline-flex; align-items: center; gap: 8px; margin: 6px 0; }
.cal-tech select { width: auto; }

/* Refunds and deleting */
.payment-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: flex-start; }
details.refund-box > summary { list-style: none; }
details.refund-box > summary::-webkit-details-marker { display: none; }
details.refund-box[open] { flex-basis: 100%; }
details.refund-box .form { margin-top: 8px; }
.refund-amount[hidden] { display: none; }
.refund-line { color: var(--red); }
.danger-zone { margin: 28px 0 12px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Jobs board */
.board-tabs { display: flex; gap: 8px; margin: 6px 0 12px; overflow-x: auto; }
.board-tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; background: var(--card);
  border: 1px solid var(--line); color: var(--text, inherit); text-decoration: none; font-weight: 600; white-space: nowrap; }
.board-tab b { background: var(--line); border-radius: 999px; padding: 1px 9px; font-size: 0.9em; }
.board-tab.on { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.board-tab.on b { background: var(--blue); color: #fff; }
.board-tab.attention b { background: #e0a100; color: #fff; }
.jobs-board td { vertical-align: top; }
.jobs-board tr.late td { background: #fff5f5; }
.late-tag { color: var(--red); font-weight: 700; font-size: 0.85em; }
.list-filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 10px; }
.list-filters label { display: flex; flex-direction: column; font-size: 0.85em; gap: 4px; }
.list-filters select { width: auto; min-width: 170px; }
.jobs-board tr.job-row { cursor: pointer; }
.jobs-board tr.job-row:hover td { background: var(--blue-soft); }
.jobs-board .unpaid { color: var(--red); }
/* Phones: each job is a small card with just what matters: number, status, how much is paid,
   client, tech and when. The rest is one tap away on the job. */
@media (max-width: 760px) {
  .jobs-board thead { display: none; }
  .jobs-board, .jobs-board tbody { display: block; width: 100%; }
  .jobs-board tr.job-row {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; box-sizing: border-box;
    grid-template-areas: "num status status" "client client paid" "tech tech sched";
    background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin: 0 0 8px; padding: 8px 12px;
  }
  .jobs-board td { border: 0; padding: 0; display: block; white-space: normal; background: none !important; }
  .jobs-board .c-num { grid-area: num; font-weight: 700; }
  .jobs-board .c-status { grid-area: status; }
  .jobs-board .c-paid { grid-area: paid; text-align: right; font-size: 0.9em; white-space: nowrap; }
  .jobs-board .c-client { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .jobs-board .table-scroll, .table-scroll:has(.jobs-board) { overflow: visible; }
  .jobs-board .c-client { grid-area: client; font-weight: 600; }
  .jobs-board .c-client a { color: inherit; text-decoration: none; }
  .jobs-board .c-tech { grid-area: tech; }
  .jobs-board .c-sched { grid-area: sched; text-align: right; font-size: 0.85em; color: var(--muted); }
  .jobs-board .c-tech:empty { display: none; }
  .jobs-board .c-city, .jobs-board .c-age, .jobs-board .c-phone { display: none; }
  .jobs-board tr.job-row > td:last-child:not([class]) { grid-column: 1 / -1; }
}

/* Filter dropdowns (Jobs, Leads, Estimates): tick several, Clear or Apply */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
details.multi-filter { position: relative; }
details.multi-filter > summary { list-style: none; cursor: pointer; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.multi-filter > summary::-webkit-details-marker { display: none; }
details.multi-filter > summary::after { content: " ▾"; }
details.multi-filter.active > summary { border-color: var(--blue); color: var(--blue); }
.mf-label { color: var(--muted); font-weight: 500; }
details.multi-filter.active .mf-label { color: inherit; }
.mf-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 240px; max-height: 60vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); display: flex; flex-direction: column; gap: 4px; }
.mf-list .check { display: flex; align-items: center; gap: 10px; padding: 6px 2px; font-size: 1em; }
.mf-list .check input { width: 20px; height: 20px; min-height: 20px; }
.mf-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.list-count { color: var(--muted); font-size: 0.9em; margin: 4px 0 8px; }
@media (max-width: 760px) { .mf-list { position: fixed; left: 12px; right: 12px; top: auto; bottom: 80px; min-width: 0; } }

/* Company logo */
.nav-brand { align-items: center; gap: 10px; }
.brand-logo { display: block; max-width: 100%; max-height: 56px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; margin-bottom: 8px; }
.header-logo { height: 32px; max-width: 96px; object-fit: contain; border-radius: 6px; }
@media (min-width: 900px) { .header-logo { display: none; } }
.public-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.public-logo { max-height: 64px; max-width: 220px; object-fit: contain; }
.logo-preview { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: inline-block; margin-bottom: 8px; }
.logo-preview img { display: block; max-height: 96px; max-width: 280px; object-fit: contain; }
