:root {
  --ember: #c45c26;
  --ember-dark: #9a3f12;
  --warm: #f7f1ea;
  --cream: #fffaf5;
  --ink: #2a211c;
  --muted: #6b5e55;
  --line: #e5d9ce;
  --ok: #2f6b3a;
  --warn: #b86e00;
  --bad: #a33;
  --card: #ffffff;
  --shadow: 0 1px 3px rgba(42,33,28,.08);
  --radius: 12px;
  --nav-h: 56px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--warm);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.45;
}
a { color: var(--ember-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.topnav {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(135deg, #3a2418 0%, #5c331f 60%, #7a3e1c 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.topnav-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; gap: .75rem;
  padding: .5rem 1rem; min-height: var(--nav-h);
  position: relative;
}
.brand {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 700; letter-spacing: .02em; color: #fff;
  text-decoration: none; margin-right: .5rem;
}
.brand-logo {
  width: 36px; height: 36px; border-radius: 9px;
  object-fit: contain; background: #fff;
  flex-shrink: 0; box-shadow: 0 0 0 1px rgba(255,255,255,.25);
}
@media (max-width: 520px) {
  .brand-logo { width: 30px; height: 30px; border-radius: 7px; }
  .brand span { font-size: .95rem; }
  .tagline { display: none; }
}
.nav-links {
  display: flex; gap: .25rem; flex: 1; min-width: 0;
}
.nav-links a {
  color: #f3e6dc; padding: .4rem .7rem; border-radius: 8px;
  font-size: .9rem; text-decoration: none; white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,.14); color: #fff; text-decoration: none;
}
.tagline { font-size: .75rem; color: #e0c9b8; margin-left: auto; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.page-head {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .75rem; margin-bottom: 1rem;
}
.page-head h1 { margin: 0; font-size: 1.45rem; flex: 1; }
.muted { color: var(--muted); font-size: .9rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  border: 1px solid transparent; border-radius: 9px;
  padding: .55rem .9rem; font-size: .92rem; font-weight: 600;
  cursor: pointer; background: var(--ember); color: #fff;
  text-decoration: none; line-height: 1.2;
}
.btn:hover { background: var(--ember-dark); text-decoration: none; color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--cream); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ember-dark); border-color: var(--line); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: #822; color: #fff; }
.btn:disabled, .btn[disabled] {
  opacity: .5; cursor: not-allowed; pointer-events: none;
}
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }

.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem; margin-bottom: 1.25rem;
}
.card-stat {
  background: var(--card); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow); border: 1px solid var(--line);
  display: block; text-decoration: none; color: inherit;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
a.card-stat:hover, a.card-stat:focus-visible {
  border-color: var(--ember); box-shadow: 0 4px 14px rgba(0,0,0,.08);
  outline: none;
}
a.card-stat:active { transform: scale(.98); }
.card-stat .n { font-size: 1.75rem; font-weight: 700; color: var(--ember-dark); }
.card-stat .l { font-size: .85rem; color: var(--muted); }

.panel {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 1rem; margin-bottom: 1rem;
}
.panel h2 { margin: 0 0 .75rem; font-size: 1.05rem; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%; border-collapse: collapse; font-size: .92rem;
}
table.data th, table.data td {
  text-align: left; padding: .65rem .5rem;
  border-bottom: 1px solid var(--line); vertical-align: top;
}
table.data th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.data tr:hover td { background: var(--cream); }

.badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600; background: #efe6dc; color: var(--ink);
}
.badge.lead, .badge.draft { background: #efe6dc; }
.badge.quoted, .badge.sent { background: #dde8f5; color: #1e4a7a; }
.badge.accepted { background: #d8f0dc; color: var(--ok); }
.badge.declined { background: #f5dede; color: var(--bad); }
.badge.scheduled { background: #e4f0e6; color: var(--ok); }
.badge.completed, .badge.paid { background: #d8f0dc; color: var(--ok); }
.badge.canceled, .badge.past\ due { background: #f5dede; color: var(--bad); }
.badge.inactive { background: #eee; color: #777; }
.badge.source { background: #f3e0d0; color: #7a3e1c; }

.flash {
  padding: .9rem 1.1rem; border-radius: 10px; margin-bottom: 1rem;
  background: #e8f5ea; color: var(--ok); border: 2px solid #c5e0c9;
  font-size: 1.05rem; font-weight: 600; line-height: 1.4;
  position: sticky; top: calc(var(--nav-h) + 4px); z-index: 40;
  box-shadow: 0 2px 10px rgba(42,33,28,.12);
}
.flash.ok {
  background: #d8f5de; color: #1a5c28; border-color: #5cbf6e;
  font-size: 1.15rem; padding: 1rem 1.15rem;
}
.flash.error, .flash.err {
  background: #fde8e8; color: #8a1f1f; border-color: #e07070;
  font-size: 1.1rem; padding: 1rem 1.15rem;
}
@media (max-width: 520px) {
  .flash, .flash.ok, .flash.error, .flash.err {
    font-size: 1.12rem; padding: 1.05rem 1rem;
    border-radius: 0; margin-left: -1rem; margin-right: -1rem;
    width: calc(100% + 2rem); max-width: none;
  }
}

.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem;
}
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .25rem; color: var(--muted); }
input[type=text], input[type=email], input[type=tel], input[type=number],
input[type=date], input[type=password], select, textarea {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
.form-actions { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.check { display: flex; align-items: center; gap: .4rem; margin-top: 1.4rem; }
.check input { width: auto; }
.check label { margin: 0; color: var(--ink); }

.search-bar {
  display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem;
}
.search-bar input { flex: 1; min-width: 160px; }
.filters { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }
.filters a {
  padding: .35rem .65rem; border-radius: 999px; background: #fff;
  border: 1px solid var(--line); font-size: .85rem; color: var(--ink);
  text-decoration: none;
}
.filters a.on { background: var(--ember); color: #fff; border-color: var(--ember); }

.lines { margin-top: .5rem; }
.line-row {
  display: grid;
  grid-template-columns: 1.4fr 1.6fr .6fr .8fr auto;
  gap: .4rem; margin-bottom: .5rem; align-items: end;
}
.line-row .del { padding: .45rem .55rem; }

.tooltip-wrap { position: relative; display: inline-block; }
.tooltip-wrap[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #2a211c; color: #fff; padding: .4rem .6rem; border-radius: 6px;
  font-size: .75rem; white-space: nowrap; z-index: 20;
}

.detail-grid {
  display: grid; grid-template-columns: 1fr; gap: 1rem;
}
@media (min-width: 800px) {
  .detail-grid { grid-template-columns: 1.2fr .8fr; }
}

.kv { display: grid; grid-template-columns: 110px 1fr; gap: .35rem .75rem; font-size: .95rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }

.stub-box {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 1rem; background: #faf6f1; margin-top: .75rem;
}
.stub-box h3 { margin: 0 0 .5rem; font-size: 1rem; }
.note {
  font-size: .88rem; color: var(--muted); background: #fff;
  border-left: 3px solid var(--ember); padding: .6rem .8rem; margin: .75rem 0;
}

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

@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .line-row { grid-template-columns: 1fr 1fr; }
  .line-row .span2 { grid-column: 1 / -1; }
  .tagline { display: none; }
  .nav-links a { padding: .35rem .5rem; font-size: .82rem; }
}

@media print {
  .topnav, .btn-row, .no-print { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .panel { box-shadow: none; border: none; }
}

/* Android / touch refinements */
.btn, .nav-links a, .filters a {
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(196,92,38,.2);
}
.nav-links a {
  display: inline-flex; align-items: center;
}
input, select, textarea, .btn {
  font-size: 16px; /* avoid iOS/Android zoom on focus */
}
.bottom-safe { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
.fab-area {
  position: sticky; bottom: 0; padding: .75rem 0 max(.75rem, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--warm) 40%);
  display: flex; gap: .5rem; flex-wrap: wrap;
}
@media (max-width: 700px) {
  .topnav-inner { padding-bottom: .4rem; }
  table.data th, table.data td { padding: .75rem .45rem; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}

/* Login */
.login-body {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: radial-gradient(ellipse at top, #efe4d8 0%, var(--warm, #f7f1ea) 55%);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid rgba(92,51,31,.12);
  border-radius: 16px;
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: 0 12px 40px rgba(92,51,31,.1);
  text-align: center;
}
.login-logo { border-radius: 12px; margin-bottom: .5rem; }
.login-card h1 { margin: .25rem 0; font-size: 1.35rem; color: #5c331f; }
.login-form { text-align: left; margin-top: 1rem; display: grid; gap: .85rem; }
.login-form label { display: grid; gap: .35rem; font-weight: 600; font-size: .9rem; }
.login-form .btn { width: 100%; margin-top: .25rem; min-height: 48px; }


/* Customer detail tabs */
.tabs {
  display: flex; flex-wrap: wrap; gap: .35rem;
  margin: 0 0 1rem; padding: 0;
}
.tabs .tab {
  display: inline-flex; align-items: center;
  padding: .45rem .9rem; min-height: 44px;
  border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-weight: 600;
  font-size: .9rem; text-decoration: none;
}
.tabs .tab:hover { background: var(--cream); text-decoration: none; }
.tabs .tab.on {
  background: var(--ember); color: #fff; border-color: var(--ember);
}
.panel-head-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: .75rem;
}
.panel-head-row h2 { margin: 0; }
.notes-body {
  white-space: pre-wrap; line-height: 1.55;
  font-size: .95rem; color: var(--ink);
}

/* Searchable customer picker */
.customer-picker { position: relative; }
.customer-picker-wrap { position: relative; }
.customer-picker-search {
  width: 100%; padding: .65rem .9rem; padding-right: 2.5rem;
  border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 16px; background: #fff; color: var(--ink);
  min-height: 48px;
}
.customer-picker-search:focus {
  outline: 2px solid rgba(196,92,38,.35); outline-offset: 1px;
  border-color: var(--ember);
}
.customer-picker-clear {
  position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: none; background: transparent;
  color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer;
  border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.customer-picker-clear:hover { background: var(--cream); color: var(--ink); }
.customer-picker-clear.is-hidden,
.customer-picker-hint.is-hidden,
.customer-picker-error.is-hidden { display: none !important; }
.customer-picker-hint { margin: .35rem 0 0; font-size: .82rem; }
.customer-picker-error {
  margin: .35rem 0 0; font-size: .85rem; color: var(--bad); font-weight: 600;
}
.customer-picker-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  z-index: 40; margin: 0; padding: .25rem 0;
  list-style: none; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(42,33,28,.14);
  max-height: min(50vh, 320px); overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.customer-picker-option {
  display: flex; flex-direction: column; gap: .1rem;
  padding: .7rem .9rem; min-height: 48px; justify-content: center;
  cursor: pointer; -webkit-tap-highlight-color: rgba(196,92,38,.15);
}
.customer-picker-option:hover,
.customer-picker-option.is-active { background: var(--cream); }
.customer-picker-option.is-selected {
  background: #f3e0d0;
}
.customer-picker-option-name {
  font-weight: 600; color: var(--ink); font-size: .95rem;
}
.customer-picker-option-meta {
  font-size: .8rem; color: var(--muted);
}
.customer-picker-empty {
  padding: .85rem 1rem; color: var(--muted); font-size: .9rem;
}

/* Searchable price-book picker (line items) */
.pb-picker { position: relative; margin-bottom: 1rem; }
.pb-picker > label { display: block; margin-bottom: .35rem; font-weight: 600; }
.pb-picker-wrap { position: relative; }
.pb-picker-search {
  width: 100%; padding: .65rem .9rem;
  border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 16px; background: #fff; color: var(--ink);
  min-height: 48px;
}
.pb-picker-search:focus {
  outline: 2px solid rgba(196,92,38,.35); outline-offset: 1px;
  border-color: var(--ember);
}
.pb-picker-hint { margin: .35rem 0 0; font-size: .82rem; }
.pb-picker-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  z-index: 40; margin: 0; padding: .25rem 0;
  list-style: none; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(42,33,28,.14);
  max-height: min(50vh, 320px); overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.pb-picker-option {
  display: flex; flex-direction: column; gap: .15rem;
  padding: .7rem .9rem; min-height: 48px; justify-content: center;
  cursor: pointer; -webkit-tap-highlight-color: rgba(196,92,38,.15);
}
.pb-picker-option:hover,
.pb-picker-option.is-active { background: var(--cream); }
.pb-picker-option-top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .75rem;
}
.pb-picker-option-name {
  font-weight: 600; color: var(--ink); font-size: .95rem;
  min-width: 0;
}
.pb-picker-option-price {
  font-weight: 700; color: var(--ember); font-size: .9rem;
  white-space: nowrap; flex-shrink: 0;
}
.pb-picker-option-meta {
  font-size: .8rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pb-picker-empty {
  padding: .85rem 1rem; color: var(--muted); font-size: .9rem;
}

/* Quick text / email tap targets */
.quick-tap-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
}
@media (min-width: 560px) {
  .quick-tap-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.quick-tap {
  min-height: 52px;
  font-size: 1rem;
  text-align: center;
  width: 100%;
}
.part-edit summary::-webkit-details-marker { display: none; }
.part-edit[open] {
  background: var(--cream);
  border-radius: 8px;
  padding: .5rem;
  border: 1px solid var(--line);
}

/* Directions — full-width tap target on job/customer detail */
.directions-wrap {
  margin-top: .85rem;
  padding-top: .85rem;
  border-top: 1px solid var(--line);
}
.directions-btn {
  width: 100%;
  min-height: 52px;
  font-size: 1.05rem;
}

.call-btn {
  background: #1e6b3a;
  border-color: #1e6b3a;
  color: #fff;
}
.call-btn:hover { background: #15522c; color: #fff; border-color: #15522c; }
.estimate-banner {
  background: #f7f3ef;
  border: 1px solid #e8ddd3;
  font-size: .95rem;
}


/* ETA minute choices — always 4 across when space allows */
.eta-tap-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 380px) {
  .eta-tap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Arrival window scheduling */
.arrival-presets {
  display: flex; flex-wrap: wrap; gap: .45rem;
  margin: .15rem 0 .55rem;
}
.arrival-chip {
  position: relative; margin: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.arrival-chip input {
  position: absolute; opacity: 0; pointer-events: none;
}
.arrival-chip span {
  display: inline-flex; align-items: baseline; gap: .35rem;
  padding: .55rem .75rem; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
  font-size: .88rem; font-weight: 600; color: var(--ink);
  white-space: nowrap;
}
.arrival-chip span em {
  font-style: normal; font-weight: 500; color: var(--muted); font-size: .8rem;
}
.arrival-chip input:checked + span {
  background: var(--ember); color: #fff; border-color: var(--ember);
}
.arrival-chip input:checked + span em { color: #f3e0d0; }
.arrival-chip input:focus-visible + span {
  outline: 2px solid var(--ember); outline-offset: 2px;
}
.arrival-custom { margin-top: .35rem; }
.arrival-hint { margin: .45rem 0 0; font-size: .8rem; }
.arrival-badge {
  display: inline-block;
  padding: .15rem .5rem; border-radius: 999px;
  background: #f3e0d0; color: #7a3e1c;
  font-size: .78rem; font-weight: 700; letter-spacing: .01em;
  white-space: nowrap;
}
input[type=time] {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
  min-height: 44px;
}
@media (max-width: 520px) {
  .arrival-presets { gap: .4rem; }
  .arrival-chip span {
    padding: .65rem .8rem; font-size: .9rem;
    min-height: 44px; align-items: center;
  }
  .arrival-chip { flex: 1 1 calc(50% - .4rem); }
  .arrival-chip span { width: 100%; justify-content: center; }
}

/* Week calendar */
.cal-week-panel { padding-bottom: .85rem; }
.cal-week-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; margin-bottom: .75rem;
}
.cal-week-label {
  font-weight: 700; font-size: 1rem; text-align: center; flex: 1;
}
.cal-nav-btn {
  min-width: 44px; min-height: 44px; padding: .35rem .65rem;
  font-size: 1.35rem; line-height: 1;
}
.cal-days {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .35rem;
}
.cal-day {
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
  padding: .45rem .2rem .4rem; border-radius: 12px;
  border: 1px solid var(--line); background: #fff;
  text-decoration: none; color: var(--ink);
  min-height: 72px; -webkit-tap-highlight-color: transparent;
}
.cal-day:hover { text-decoration: none; border-color: #d0b49a; background: #fffaf5; }
.cal-day.selected {
  background: var(--ember); color: #fff; border-color: var(--ember);
}
.cal-day.today:not(.selected) {
  box-shadow: inset 0 0 0 2px var(--ember);
}
.cal-dow { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.cal-day.selected .cal-dow { color: #f3e0d0; }
.cal-num { font-size: 1.15rem; font-weight: 700; line-height: 1.1; }
.cal-dot {
  min-width: 1.15rem; height: 1.15rem; padding: 0 .28rem;
  border-radius: 999px; background: #f3e0d0; color: #7a3e1c;
  font-size: .68rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.cal-day.selected .cal-dot { background: rgba(255,255,255,.28); color: #fff; }
.cal-dot.empty { background: transparent; color: transparent; }

.cal-appt-list { list-style: none; padding: 0; margin: 0; }
.cal-appt-list li { border-bottom: 1px solid var(--line); }
.cal-appt-list li:last-child { border-bottom: none; }
.cal-appt {
  display: block; padding: .85rem .15rem; color: inherit; text-decoration: none;
  border-radius: 8px;
}
.cal-appt:hover { background: #fffaf5; text-decoration: none; }
.cal-appt-main {
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .65rem;
  margin-bottom: .35rem;
}
.cal-appt-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .65rem;
  font-size: .88rem; margin-bottom: .25rem;
}
.cal-appt-loc { font-size: .85rem; }
.cal-appt-notes { font-size: .82rem; margin: .2rem 0 .35rem; }
.cal-appt-foot {
  display: flex; justify-content: space-between; gap: .5rem;
  font-size: .82rem; font-weight: 600;
}
@media (max-width: 520px) {
  .cal-day { min-height: 68px; padding: .4rem .1rem .35rem; border-radius: 10px; }
  .cal-num { font-size: 1.05rem; }
  .cal-dow { font-size: .65rem; }
  .cal-week-label { font-size: .92rem; }
}

/* Day miles estimator (calendar day view) */
.cal-appt-actions {
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem;
  padding: 0 .15rem .7rem;
  min-width: 0; max-width: 100%;
}
.cal-appt-actions > * { min-width: 0; }
/* Phones: tidy 3-per-row grid so every action button is visible + tappable (was one nowrap row
   right-aligned, so the first button overflowed past the left edge where it can't be scrolled to). */
@media (max-width: 560px) {
  .cal-appt-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); justify-content: stretch; }
  .cal-appt-actions > .btn, .cal-appt-actions form, .cal-appt-actions form .btn { width: 100%; }
  .cal-appt-actions .btn { white-space: normal; text-align: center; padding-left: .4rem; padding-right: .4rem; }
  .cal-appt-actions form { display: block; }
}
.cal-miles-link {
  padding: .35rem .7rem; font-size: .78rem; min-height: 36px;
}
.day-miles {
  margin-top: 1rem;
  padding-top: .95rem;
  border-top: 1px solid var(--line);
}
.day-miles-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
  margin-bottom: .85rem;
}
.day-miles-stat {
  background: #fffaf5;
  border: 1px solid #f0dfd0;
  border-radius: 12px;
  padding: .65rem .7rem;
  text-align: center;
}
.day-miles-stat .l {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: .25rem;
}
.day-miles-stat .n {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}
.day-miles-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .65rem .85rem;
  margin-bottom: .55rem;
}
.day-miles-override {
  flex: 1 1 140px;
  min-width: 120px;
}
.day-miles-override label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: .3rem;
}
.day-miles-override input {
  width: 100%;
  min-height: 44px;
  font-size: 1rem;
}
.day-miles-btns { margin: 0; }
.day-miles-note {
  font-size: .8rem;
  line-height: 1.4;
  margin: .35rem 0 0;
}
@media (max-width: 520px) {
  .day-miles-stats { grid-template-columns: 1fr; }
  .day-miles-stat .n { font-size: 1.25rem; }
  .day-miles-form { flex-direction: column; align-items: stretch; }
  .day-miles-btns .btn { min-height: 44px; }
}

/* Photo gallery (jobs + customers) */
.photo-gallery { margin-top: .35rem; }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.photo-card {
  margin: 0;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.photo-thumb {
  display: block;
  aspect-ratio: 1 / 1;
  background: #ebe3da;
  overflow: hidden;
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-meta {
  padding: .45rem .55rem .55rem;
  font-size: .78rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.photo-caption { font-weight: 600; color: var(--ink); word-break: break-word; }
.photo-when { font-size: .72rem; }
.photo-del { margin-top: .25rem; }
.btn-tiny {
  padding: .3rem .55rem;
  font-size: .75rem;
  min-height: 32px;
}
.photo-upload {
  border-top: 1px solid var(--line);
  padding-top: .85rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.photo-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}
.photo-add-btn {
  min-height: 52px;
  font-size: 1.05rem;
  width: 100%;
  cursor: pointer;
}
.photo-caption-field label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: .3rem;
}
.photo-caption-field input {
  width: 100%;
  min-height: 44px;
  font-size: 1rem;
  padding: .5rem .65rem;
  border: 1px solid var(--line);
  border-radius: 9px;
}
@media (min-width: 720px) {
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .photo-add-btn { width: auto; align-self: flex-start; min-width: 200px; }
}

/* Places address autocomplete */
.places-ac-wrap { position: relative; }
.places-ac-wrap > input {
  width: 100%; font-size: 16px; /* prevent iOS zoom */
}
.places-ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  z-index: 45; margin: 0; padding: .25rem 0;
  list-style: none; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(42,33,28,.14);
  max-height: min(50vh, 320px); overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.places-ac-list.is-hidden,
.places-ac-hint.is-hidden { display: none !important; }
.places-ac-option {
  display: flex; flex-direction: column; gap: .1rem;
  padding: .75rem .9rem; min-height: 48px; justify-content: center;
  cursor: pointer; -webkit-tap-highlight-color: rgba(196,92,38,.15);
}
.places-ac-option:hover,
.places-ac-option.is-active { background: var(--cream); }
.places-ac-option-main {
  font-weight: 500; color: var(--ink); font-size: .95rem;
  line-height: 1.35;
}
.places-ac-hint {
  margin: .35rem 0 0; font-size: .82rem;
}

/* Income page */
.card-stat-warn .n { color: var(--warn); }
.badge.unpaid { background: #f8e8c8; color: var(--warn); }
.panel-unpaid {
  border: 2px solid #e8c48a;
  background: linear-gradient(180deg, #fff8ee 0%, #fff 48%);
}
.panel-unpaid h2 { color: #7a4a00; }
.row-unpaid td { background: #fffaf0; }
.income-controls { padding-bottom: .85rem; }
.income-control-row {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: .75rem 1.25rem;
}
.income-controls .tabs { margin: 0; }
.income-invoice-toggle { margin: 0; }
.check-inline {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 600; font-size: .9rem; cursor: pointer;
  min-height: 44px;
}
.check-inline input { width: 1.15rem; height: 1.15rem; accent-color: var(--ember); }
.income-period { margin-bottom: 1.25rem; }
.income-period:last-child { margin-bottom: 0; }
.income-period-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem .85rem;
  margin: 0 0 .45rem; padding: .35rem 0;
  border-bottom: 1px solid var(--line);
}
.income-period-total {
  margin-left: auto; font-weight: 700; color: var(--ember-dark); font-size: 1.05rem;
}


/* Ledger (books) — separate from Income payout log */
.ledger-nav-panel { padding-bottom: .65rem; }
.ledger-tabs {
  display: flex; flex-wrap: wrap; gap: .35rem;
  max-width: 100%;
}
.ledger-tabs .tab { font-size: .85rem; padding: .4rem .65rem; }
.ledger-total-row td {
  border-top: 2px solid var(--line);
  background: var(--cream);
}
.ledger-cat {
  display: inline-block;
  padding: .15rem .45rem;
  border-radius: 999px;
  background: #f0e6dc;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 600;
}
.ledger-cat-supplies { background: #e8f0e4; color: #2f5a28; }
.ledger-cat-vehicle { background: #e4eef8; color: #1e4a7a; }
.ledger-cat-insurance { background: #f3e8f8; color: #5a2f7a; }
.ledger-cat-tools { background: #f8efe4; color: #7a4a1e; }
.ledger-cat-meals { background: #f8e8e8; color: #7a2f2f; }
.ledger-cat-bank-fee { background: #eee; color: #444; }
.ledger-crm-panel {
  border: 1px dashed var(--line);
  background: #faf8f5;
}
.ledger-crm-list {
  margin: 0; padding-left: 1.2rem; line-height: 1.7; font-size: .92rem;
}
.ledger-crm-stats {
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem;
  font-size: .92rem;
}
@media (max-width: 720px) {
  .ledger-tabs .tab { font-size: .78rem; padding: .35rem .5rem; }
}
.ledger-scope {
  display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .75rem;
  margin: 0 0 .5rem; font-size: .95rem;
}
.ledger-scope-all {
  display: inline-flex; align-items: center; min-height: 36px;
  padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-weight: 600; font-size: .85rem; text-decoration: none;
}
.ledger-scope-all:hover { background: var(--cream); text-decoration: none; }
.ledger-scope-all::before { content: "\2190\00a0"; }
.ledger-cards-month .card-stat { border-color: var(--ember); }
.ledger-acc { margin-bottom: 1rem; }
.ledger-acc > .acc-sum .acc-meta { white-space: normal; }
.ledger-acc > .acc-sum .acc-meta strong { color: var(--ember-dark); }
.ledger-acc > .acc-body { padding: .6rem .75rem .9rem; }

/* ── Tags (chips + pills) ── */
.tag-picker { margin-top: .25rem; }
.tag-chip-row {
  display: flex; flex-wrap: wrap; gap: .4rem;
}
.tag-chip {
  position: relative; margin: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tag-chip input {
  position: absolute; opacity: 0; pointer-events: none;
}
.tag-chip span {
  display: inline-flex; align-items: center;
  padding: .45rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
  font-size: .82rem; font-weight: 600; color: var(--ink);
  white-space: nowrap; min-height: 40px;
}
.tag-chip input:checked + span {
  background: #5c331f; color: #fff; border-color: #5c331f;
}
.tag-chip input:focus-visible + span {
  outline: 2px solid var(--ember); outline-offset: 2px;
}
.tag-add-row { margin-top: .55rem; }
.tag-new-input {
  width: 100%; max-width: 280px;
  padding: .55rem .75rem; border: 1px solid var(--line);
  border-radius: 9px; font: inherit; background: #fff;
  min-height: 44px;
}
.tag-add-hint { display: block; margin-top: .35rem; font-size: .78rem; }
.tag-pills { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
.tag-pill {
  display: inline-block;
  padding: .12rem .45rem; border-radius: 999px;
  background: #f3e0d0; color: #7a3e1c;
  font-size: .72rem; font-weight: 700; letter-spacing: .01em;
  white-space: nowrap;
}
.tag-filter-bar {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  gap: .65rem; margin: 0 0 1rem;
  padding: .75rem; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.tag-filter-row { flex: 1; }
.tag-filter-clear { align-self: center; }

/* Collapsed tag filter (Jobs + Customers list) */
.tag-filter-fold { margin: 0 0 1rem; }
.tag-filter-fold > summary { list-style: none; }
.tag-filter-fold > summary::-webkit-details-marker { display: none; }
.tag-filter-sum {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .75rem; border-radius: 999px; background: #fff;
  border: 1px solid var(--line); font-size: .85rem; font-weight: 600;
  color: var(--ink); cursor: pointer; min-height: 36px;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.tag-filter-fold[open] > .tag-filter-sum {
  background: var(--cream); border-color: var(--ember);
  color: var(--ember-dark); margin-bottom: .5rem;
}
.tag-filter-sum:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.tag-filter-chev { font-size: .75rem; line-height: 1; transition: transform .15s ease; }
.tag-filter-fold[open] > .tag-filter-sum .tag-filter-chev { transform: rotate(180deg); }
.tag-filter-fold .tag-filter-bar { margin-bottom: 0; }
.tag-manage-list {
  list-style: none; margin: .75rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .5rem .75rem;
}
.tag-manage-list li {
  display: inline-flex; align-items: center; gap: .4rem;
}
.btn-tiny {
  padding: .25rem .55rem; font-size: .78rem; min-height: 32px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ── Customer 360 A/R ── */
.ar-summary { margin-bottom: 1rem; }
.ar-hero {
  display: flex; flex-wrap: wrap; gap: 1rem 1.5rem;
  align-items: flex-start;
}
.ar-balance { min-width: 140px; }
.ar-label {
  font-size: .8rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.ar-amount {
  font-size: 1.85rem; font-weight: 800; line-height: 1.15;
  margin: .15rem 0;
}
.ar-amount.owes { color: var(--warn); }
.ar-amount.clear { color: var(--ok); }
.ar-aging {
  display: grid; grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: .5rem; flex: 1; min-width: 240px;
}
.ar-aging-item {
  background: var(--cream); border: 1px solid var(--line);
  border-radius: 10px; padding: .55rem .6rem; text-align: center;
}
.ar-aging-label {
  display: block; font-size: .72rem; font-weight: 600;
  color: var(--muted); margin-bottom: .2rem;
}
.panel-open-jobs {
  border: 2px solid #c5dcc9;
  background: linear-gradient(180deg, #f3faf4 0%, #fff 50%);
}

/* Timeline */
.timeline {
  list-style: none; margin: 0; padding: 0;
  border-left: 2px solid var(--line);
}
.timeline-item {
  position: relative; padding: .55rem 0 .55rem 1rem;
  margin-left: .35rem;
}
.timeline-item::before {
  content: ""; position: absolute; left: -5px; top: .9rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ember); border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}
.timeline-meta {
  display: flex; flex-wrap: wrap; gap: .35rem .65rem;
  align-items: baseline; font-size: .92rem;
}
.timeline-meta time {
  font-size: .78rem; color: var(--muted); font-weight: 600;
}
.timeline-detail { margin-top: .25rem; font-size: .9rem; }
.timeline-notes .timeline-detail {
  max-height: 12rem; overflow: auto;
  background: var(--cream); padding: .65rem .75rem;
  border-radius: 8px; border: 1px solid var(--line);
}
.timeline-compact .timeline-item { padding: .35rem 0 .35rem 1rem; }

@media (max-width: 700px) {
  .ar-aging { grid-template-columns: repeat(2, 1fr); }
  .ar-amount { font-size: 1.55rem; }
  .tag-chip { flex: 1 1 calc(50% - .4rem); }
  .tag-chip span { width: 100%; justify-content: center; }
}


/* Complete job flow */
.complete-choices {
  display: grid;
  gap: .65rem;
}
.complete-card {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .9rem 1rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.complete-card input { margin-top: .2rem; flex-shrink: 0; }
.complete-card.selected {
  border-color: var(--ember);
  background: #fff;
  box-shadow: 0 2px 10px rgba(196,92,38,.12);
}
.pay-method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .45rem;
}
.pay-method-chip {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
}
.pay-method-chip:has(input:checked) {
  border-color: var(--ember);
  background: #fff5ee;
}
.mark-paid-details { position: relative; }
.mark-paid-details > summary::-webkit-details-marker { display: none; }

/* ─── Tappable rows / entity links (Oct 2026) ─── */
[data-href] { cursor: pointer; }
table.data tbody tr[data-href]:hover td { background: rgba(196, 92, 38, .06); }
table.data tbody tr[data-href]:active td { background: rgba(196, 92, 38, .12); }
li[data-href]:active { background: rgba(196, 92, 38, .08); }
[data-href]:focus-visible { outline: 2px solid var(--ember); outline-offset: -2px; }
a.tag-pill { text-decoration: none; color: inherit; }
a.tag-pill:hover { filter: brightness(.95); text-decoration: underline; }
.icon-link { text-decoration: none; display: inline-block; min-width: 1.6em; text-align: center; }
table.data a { text-decoration-color: rgba(0,0,0,.25); }
a .badge { cursor: pointer; }

/* Field actions on job detail: big thumb targets, grouped at top */
.field-actions .field-primary { margin-bottom: .6rem; }
.field-actions .field-primary .btn { min-height: 56px; font-size: 1.05rem; font-weight: 700; }
.field-actions .quick-tap { min-height: 48px; }
.field-actions .field-address { margin: -.2rem 0 .7rem; font-size: .9rem; }
.field-actions .field-address a { color: inherit; }
@media (max-width: 640px) {
  .field-actions .field-primary { grid-template-columns: 1fr 1fr; }
}

/* Income source segmented control (All / HearthHelp / Vogl / …) */
.seg-control {
  display: flex; flex-wrap: wrap; gap: 0; margin: .25rem 0 1rem;
  border: 1px solid var(--line, #e3d9cc); border-radius: 12px; overflow: hidden;
  background: #fff; width: 100%; max-width: 640px;
}
.seg-control .seg {
  flex: 1 1 0; min-width: 6.5rem; text-align: center; padding: .75rem .6rem;
  min-height: 48px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: inherit; text-decoration: none;
  border-right: 1px solid var(--line, #e3d9cc);
}
.seg-control .seg:last-child { border-right: 0; }
.seg-control .seg:hover { background: var(--cream, #faf5ee); text-decoration: none; }
.seg-control .seg.on { background: var(--ember, #c45c26); color: #fff; }
.income-breakdown { margin: -.4rem 0 1rem; font-size: .88rem; }
.income-breakdown a { color: inherit; white-space: nowrap; }
.income-breakdown a.on { text-decoration: underline; }

/* "View invoice HH-xxxx" (replaces Create invoice when the job already has one) */
.job-invoice-link { display: inline-flex; align-items: center; gap: .4rem; }
.job-invoice-link .badge { font-size: .72rem; }


/* Top nav: primary links + "Menu" dropdown for everything else */
.nav-menu { position: relative; flex-shrink: 0; }
.nav-menu-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  min-height: 44px; padding: .4rem .8rem;
  font: inherit; font-size: .9rem; font-weight: 600;
  color: #f3e6dc; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.22); border-radius: 8px;
  cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(196,92,38,.2);
}
.nav-menu-btn:hover, .nav-menu-btn.active, .nav-menu.open .nav-menu-btn {
  background: rgba(255,255,255,.18); color: #fff;
}
.nav-menu-btn:focus-visible { outline: 2px solid #f0b98f; outline-offset: 2px; }
.nav-menu-btn.active { border-color: rgba(255,255,255,.45); }
.nav-menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 260px; z-index: 60;
  background: var(--cream); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(42,33,28,.22);
  padding: .5rem;
  max-height: calc(100vh - var(--nav-h) - 1rem);
  max-height: calc(100dvh - var(--nav-h) - 1rem);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.nav-menu-panel[hidden] { display: none; }
.nav-menu-group + .nav-menu-group { margin-top: .25rem; padding-top: .25rem; border-top: 1px solid var(--line); }
.nav-menu-heading {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); padding: .35rem .65rem .15rem;
}
.nav-menu-items { display: grid; grid-template-columns: 1fr; gap: 2px; }
.nav-menu-panel a {
  display: flex; align-items: center; min-height: 44px;
  padding: .45rem .75rem; border-radius: 8px;
  color: var(--ink); font-size: .95rem; font-weight: 500;
  text-decoration: none; touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(196,92,38,.2);
}
.nav-menu-panel a:hover, .nav-menu-panel a:focus-visible {
  background: #f1e6da; text-decoration: none; outline: none;
}
.nav-menu-panel a.active {
  background: #f3e0d0; color: var(--ember-dark); font-weight: 700;
  box-shadow: inset 3px 0 0 var(--ember);
}
.nav-menu-footer {
  display: grid; grid-template-columns: 1fr 1fr; gap: .35rem;
  margin-top: .35rem; padding-top: .5rem; border-top: 1px solid var(--line);
}
.nav-menu-footer a { justify-content: center; border: 1px solid var(--line); background: #fff; }
.nav-menu-panel a.nav-logout { color: var(--bad); }
.nav-menu-panel a.nav-logout:hover { background: #fbeaea; }

@media (max-width: 600px) {
  .topnav-inner { gap: .4rem; padding: .45rem .6rem; }
  .brand { margin-right: .15rem; }
  .nav-links { gap: .1rem; }
  .nav-links a { padding: .35rem .5rem; font-size: .85rem; }
  .nav-menu { position: static; }
  .nav-menu-btn { padding: .4rem .6rem; }
  .nav-menu-panel {
    left: .5rem; right: .5rem; width: auto; top: calc(100% + 4px);
  }
  .nav-menu-items { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .brand span { display: none; }
}
@media (max-width: 360px) {
  .nav-menu-label { display: none; }
  .nav-links a { padding: .35rem .4rem; font-size: .8rem; }
}

/* Quick Quality hours tracker */
.qq-sub { margin: -.5rem 0 1rem; }
.qq-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: -.25rem; }
.qq-chip {
  min-height: 44px; min-width: 56px; padding: .4rem .8rem;
  border-radius: 999px; border: 1px solid var(--line); background: #fff;
  font: inherit; font-size: .95rem; font-weight: 600; color: var(--ink);
  cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(196,92,38,.2);
}
.qq-chip:hover { background: var(--cream); }
.qq-chip.on { background: var(--ember); border-color: var(--ember); color: #fff; }
.qq-total-row {
  display: flex; align-items: baseline; justify-content: space-between;
  background: #f7efe6; border: 1px solid var(--line); border-radius: 10px;
  padding: .6rem .85rem;
}
.qq-total { font-size: 1.5rem; color: var(--ember-dark); }
.qq-save { min-width: 160px; }
.qq-cards { margin-bottom: .5rem; }
.qq-cards .card-stat { cursor: default; }
.qq-cards .card-stat .n { font-size: 1.45rem; }
.qq-received { font-size: .85rem; margin: 0 0 1rem; }
.qq-month + .qq-month { margin-top: 1rem; }
.qq-month-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem;
  font-weight: 700; padding: .35rem 0; border-bottom: 2px solid var(--line);
  font-size: .95rem;
}
.qq-month-head .muted { font-weight: 400; font-size: .85rem; }
.qq-month-amt { color: var(--ember-dark); }
.qq-list { list-style: none; margin: 0; padding: 0; }
.qq-row {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center;
  gap: .35rem .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line);
}
.qq-row.editing { background: #fbf1e7; box-shadow: inset 3px 0 0 var(--ember); padding-left: .5rem; }
.qq-row-date { font-weight: 600; }
.qq-row-calc { font-size: .85rem; }
.qq-row-amt { font-weight: 700; color: var(--ember-dark); font-size: 1.05rem; text-align: right; }
.qq-row-actions { display: flex; gap: .35rem; }
.qq-row-actions form { margin: 0; }
.qq-btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.qq-del { color: var(--bad); }
.qq-rate-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem; }
.qq-rate-form > div { flex: 1; min-width: 140px; max-width: 220px; }
@media (max-width: 520px) {
  .qq-row { grid-template-columns: 1fr auto; }
  .qq-row-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .qq-form .qq-save { width: 100%; }
}

/* Income source toggle: 4 sources (All / HearthHelp / Vogl / Quick Quality) fit one row on phones */
@media (max-width: 560px) {
  .seg-control .seg {
    min-width: 0; padding: .55rem .3rem; font-size: .84rem; line-height: 1.15;
  }
}

/* Quick Quality site (Delta / Duchesne / Moroni) + Delta building (A–E) tap pickers */
.qq-pick-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.qq-pick-group[hidden] { display: none; }
.qq-pick-group legend {
  font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: .3rem; padding: 0;
}
.qq-pick-row { display: grid; gap: .4rem; max-width: 420px; }
.qq-pick-sites { grid-template-columns: repeat(3, 1fr); }
.qq-pick-buildings { grid-template-columns: repeat(5, 1fr); }
.qq-pick { position: relative; display: block; margin: 0; cursor: pointer; }
.qq-pick input {
  position: absolute; opacity: 0; width: 100%; height: 100%; inset: 0; margin: 0; cursor: pointer;
}
.qq-pick span {
  display: flex; align-items: center; justify-content: center;
  min-height: 48px; padding: .4rem .3rem; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 1rem; font-weight: 700; text-align: center;
  touch-action: manipulation; -webkit-tap-highlight-color: rgba(196,92,38,.2);
}
@media (hover: hover) { .qq-pick:hover input:not(:checked) + span { background: var(--cream); } }
.qq-pick input:checked + span { background: var(--ember); border-color: var(--ember); color: #fff; }
.qq-pick input:focus-visible + span { outline: 2px solid var(--ember-dark); outline-offset: 2px; }
.qq-row-where { margin: .1rem 0; }
.qq-tag {
  display: inline-block; padding: .1rem .5rem; border-radius: 999px;
  background: #f3e0d0; color: #7a3e1c; font-size: .78rem; font-weight: 700;
}

/* Quick Quality: Delta codes on building buttons + by-site totals */
.qq-pick-code { font-size: .78em; font-weight: 600; opacity: .85; margin-left: .15rem; }
.qq-pick-buildings .qq-pick span { flex-direction: row; white-space: nowrap; }
@media (max-width: 420px) {
  .qq-pick-buildings .qq-pick span { flex-direction: column; line-height: 1.1; }
  .qq-pick-buildings .qq-pick-code { margin: 0; }
  .qq-pick-buildings .qq-dot { display: none; }
}
.qq-site-list { list-style: none; margin: 0; padding: 0; }
.qq-site-list li {
  display: grid; grid-template-columns: 1fr auto 6.5rem; gap: .75rem; align-items: baseline;
  padding: .45rem 0; border-bottom: 1px solid var(--line);
}
.qq-site-list li:last-child { border-bottom: 0; }
.qq-site-list li > :last-child { text-align: right; }
.qq-site-group .qq-site-name { font-weight: 700; }
.qq-site-sub { padding-left: 1.1rem !important; font-size: .92rem; }
.qq-site-sub .qq-site-name::before { content: "↳ "; color: var(--muted); }
.qq-site-unassigned .qq-site-name { color: var(--muted); font-style: italic; }

/* Quick Quality report (screen + print) */
.qq-report-controls .seg-control { margin-top: 0; }
.qq-range-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem; margin-bottom: .75rem; }
.qq-range-form > div { flex: 1 1 140px; max-width: 200px; }
.qq-notes-toggle { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; margin: 0; color: var(--ink); font-size: .9rem; }
.qq-notes-toggle input { width: auto; }
.qq-report {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1rem; color: #1f1915;
}
.qq-report-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem;
  border-bottom: 2px solid #5c331f; padding-bottom: .6rem; margin-bottom: .9rem;
}
.qq-report-head h2 { margin: 0; font-size: 1.2rem; color: #5c331f; }
.qq-report-range { font-weight: 600; margin-top: .15rem; }
.qq-report-from { text-align: right; font-size: .9rem; }
.qq-report-from .muted { font-size: .8rem; }
.qq-report-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.qq-report-table th, .qq-report-table td { padding: .45rem .4rem; border-bottom: 1px solid #e8ddd2; text-align: left; vertical-align: top; }
.qq-report-table th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.qq-report-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qq-report-table .nowrap { white-space: nowrap; }
.qq-report-table tr.qq-zero td { color: #a89a8e; }
.qq-report-table tr.qq-unassigned td { font-style: italic; }
.qq-report-table .qq-note-cell { font-size: .82rem; color: var(--muted); }
.qq-report-sub { margin: 1.1rem 0 .3rem; font-size: 1rem; color: #5c331f; }
.qq-report-subtotals { max-width: 520px; }
.qq-report-subtotals tfoot td { border-top: 2px solid #5c331f; border-bottom: 0; font-weight: 800; font-size: 1rem; }
.qq-report-foot { font-size: .78rem; color: var(--muted); margin: .75rem 0 0; }
@media (max-width: 520px) {
  .qq-report { padding: .85rem .7rem; }
  .qq-report-table { font-size: .85rem; }
  .qq-report-table th, .qq-report-table td { padding: .4rem .25rem; }
  .qq-report-from { text-align: left; }
}
@media print {
  .flash { display: none !important; }
  .qq-report { border: 0; box-shadow: none; padding: 0; margin: 0; }
  .qq-report-table { font-size: 10.5pt; }
  .qq-report-table tr { break-inside: avoid; }
  @page { margin: 0.6in; }
}

/* Ledger receipts + Add expense */
.exp-sub { margin: -.5rem 0 1rem; font-size: .9rem; }
.exp-form { padding: 1rem; }
.exp-label, .exp-cats legend { font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: .35rem; padding: 0; }
.exp-receipt-block { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.exp-receipt-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; max-width: 460px; }
.exp-receipt-btns .btn { min-height: 52px; font-size: 1rem; cursor: pointer; }
.exp-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; z-index: -1; }
.exp-hint { font-size: .8rem; margin: .45rem 0 0; }
.exp-previews { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.exp-prev { width: 84px; }
.exp-prev img, .exp-prev-pdf {
  width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; background: #fff; font-weight: 700;
}
.exp-prev-name { font-size: .7rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-cats { border: 0; margin: 0; padding: 0; min-width: 0; }
.exp-cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.exp-cat { position: relative; display: block; margin: 0; cursor: pointer; }
.exp-cat input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.exp-cat .ledger-cat {
  display: flex; align-items: center; justify-content: center; min-height: 48px;
  border-radius: 10px; font-size: .92rem; border: 2px solid transparent; text-align: center;
}
.exp-cat input:checked + .ledger-cat { border-color: var(--ember); box-shadow: 0 0 0 2px rgba(196,92,38,.25); }
.exp-cat input:focus-visible + .ledger-cat { outline: 2px solid var(--ember-dark); outline-offset: 2px; }
.exp-dups {
  margin-top: 1rem; padding: .75rem; border-radius: 10px;
  background: #fff6e6; border: 2px solid #e8b04a;
}
.exp-dups[hidden] { display: none; }
.exp-dups-head { font-weight: 700; margin-bottom: .4rem; color: #7a4a00; }
.exp-dup-opt { display: flex; gap: .5rem; align-items: flex-start; padding: .45rem 0; margin: 0; font-size: .9rem; color: var(--ink); font-weight: 400; cursor: pointer; }
.exp-dup-opt input { width: 20px; height: 20px; flex-shrink: 0; margin-top: .1rem; }
.exp-actions { margin-top: 1rem; }
.exp-save { min-width: 170px; }
@media (max-width: 520px) {
  .exp-actions .btn { flex: 1 1 100%; }
}

.ledger-tab-badge {
  display: inline-block; min-width: 1.3rem; padding: 0 .35rem; margin-left: .2rem;
  border-radius: 999px; background: #e8b04a; color: #3a2418; font-size: .72rem; font-weight: 800; text-align: center;
}
.ledger-meta { font-size: .78rem; margin-top: .15rem; }
.ledger-dup-flag { margin-top: .25rem; font-size: .8rem; font-weight: 600; color: #8a5a00; }
.ledger-dup-banner { font-size: .95rem; }
.ledger-dup-panel { border: 2px solid #e8b04a; background: #fffaf0; }
.rcpt-cell { white-space: nowrap; }
.rcpt-thumbs { display: inline-flex; gap: .3rem; align-items: center; }
.rcpt-thumb img, .rcpt-thumb .rcpt-pdf {
  width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; background: #fff; font-size: .7rem; font-weight: 800; color: var(--bad);
}
.rcpt-quick { margin: 0; }
.rcpt-add {
  display: inline-flex; align-items: center; justify-content: center; gap: .2rem;
  min-height: 44px; padding: .3rem .65rem; border-radius: 8px; border: 1px dashed #c9a98f;
  background: #fffaf5; color: var(--ember-dark); font-size: .82rem; font-weight: 700; cursor: pointer; margin: 0;
}
.rcpt-add input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.rcpt-list { list-style: none; margin: 0; padding: 0; }
.rcpt-row {
  display: grid; grid-template-columns: 1fr auto; gap: .35rem .75rem; align-items: center;
  padding: .6rem 0; border-bottom: 1px solid var(--line);
}
.rcpt-top { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.rcpt-amt { margin-left: auto; }
.rcpt-desc { font-size: .84rem; margin-top: .2rem; overflow-wrap: anywhere; }
.rcpt-dup-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem; }
.rcpt-dup-actions form { margin: 0; }
.rcpt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.rcpt-card { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.rcpt-card img, .rcpt-card-pdf { width: 100%; height: 140px; object-fit: cover; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.rcpt-card figcaption { padding: .35rem .45rem; display: grid; gap: .25rem; }
.rcpt-card-name { font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) {
  .rcpt-row { grid-template-columns: 1fr; }
  .rcpt-side { justify-self: start; }
}

/* ── Collapsible sections (customer + job detail) ── */
.acc {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: .65rem; overflow: hidden;
}
.acc > summary { list-style: none; }
.acc > summary::-webkit-details-marker { display: none; }
.acc-sum {
  display: flex; align-items: center; gap: .75rem;
  min-height: 56px; padding: .6rem .9rem .6rem 1rem;
  cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none;
}
@media (hover: hover) { .acc-sum:hover { background: var(--cream); } }
.acc-sum:focus-visible { outline: 2px solid var(--ember); outline-offset: -2px; }
.acc-head { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.acc-title { font-weight: 700; font-size: 1.02rem; color: var(--ink); }
.acc-count { color: var(--muted); font-weight: 600; }
.acc-meta {
  color: var(--muted); font-size: .86rem; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acc-meta .tag-pills { white-space: normal; padding: .1rem 0; }
.acc-meta:has(> .tag-pills) { white-space: normal; }
.acc-meta .tag-pills { gap: .35rem; }
.acc-meta .tag-pill { font-size: .78rem; padding: .25rem .6rem; }
.acc-taglinks { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0 0 .85rem; }
.acc-taglinks a.tag-pill {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 .9rem; font-size: .85rem;
}
.acc-meta .acc-hot { color: var(--ember-dark); }
.acc-meta .acc-alert { color: var(--bad); }
.acc-chev {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; position: relative;
}
.acc-chev::before {
  content: ""; position: absolute; left: 50%; top: 45%;
  width: 8px; height: 8px; border-right: 2px solid var(--ember-dark); border-bottom: 2px solid var(--ember-dark);
  transform: translate(-50%, -50%) rotate(45deg);
}
.acc[open] > .acc-sum .acc-chev::before { top: 58%; transform: translate(-50%, -50%) rotate(-135deg); }
.acc[open] > .acc-sum { border-bottom: 1px solid var(--line); background: var(--cream); }
.acc-body { padding: .9rem 1rem 1rem; }
.acc-hl { border-left: 4px solid var(--ember); }
.acc-bad { border-left: 4px solid var(--bad); }
.acc-body-head {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  flex-wrap: wrap; margin-bottom: .65rem;
}
.acc-body-head h3, .acc-sub { margin: 0; font-size: .98rem; }
.acc-sub { margin: 1.1rem 0 .5rem; }
.acc-body-head .btn, .acc-body .form-actions .btn { min-height: 44px; }
.acc-controls { display: flex; justify-content: flex-end; gap: .4rem; margin: 0 0 .5rem; }
.acc-controls .btn { min-height: 44px; font-size: .82rem; padding: .4rem .75rem; background: transparent; }

/* ── Customer contact card ── */
.contact-card { padding: .85rem 1rem .4rem; margin-bottom: .75rem; }
.contact-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.contact-head h1 { flex: 1 1 12rem; margin: 0; font-size: 1.4rem; min-width: 0; overflow-wrap: anywhere; }
.contact-head-actions { display: flex; gap: .4rem; align-items: center; }
.contact-head-actions .btn { min-height: 44px; }
.contact-lines { list-style: none; margin: .55rem 0 0; padding: 0; }
.contact-line { display: flex; align-items: center; gap: .5rem; border-top: 1px solid var(--line); }
.contact-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: .65rem;
  min-height: 50px; padding: .35rem 0; color: var(--ink); font-size: 1rem;
}
.contact-main:hover { text-decoration: none; }
.contact-main .ci { width: 1.5rem; text-align: center; flex: 0 0 auto; }
.contact-main .ct { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.contact-hint { flex: 0 0 auto; font-size: .78rem; font-weight: 700; color: var(--ember-dark); }
.contact-hint::after { content: " ›"; }
.contact-side {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 76px; padding: 0 .75rem; border-radius: 9px;
  border: 1px solid var(--line); background: var(--cream); color: var(--ink); font-weight: 700; font-size: .9rem;
}
.contact-side:hover { text-decoration: none; background: #f3e0d0; }
.more-menu { position: relative; }
.more-menu > summary { list-style: none; cursor: pointer; }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 190px;
  max-width: calc(100vw - 16px); max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(42,33,28,.16); padding: .3rem;
}
/* accordion.js flips the panel to open rightward when the button sits near the left edge. */
.more-menu-panel.mm-left { right: auto; left: 0; }
/* Phones: render every "More ▾" menu as a full-width bottom sheet so nothing can clip off-screen. */
@media (max-width: 640px) {
  .more-menu[open] > summary::before {
    content: ""; position: fixed; inset: 0; z-index: 65; background: rgba(42,33,28,.38); cursor: default;
  }
  .more-menu-panel, .more-menu-panel.mm-left {
    position: fixed; left: 8px; right: 8px; top: auto; bottom: 8px; bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 66; min-width: 0; max-width: none; max-height: 75vh; max-height: 75dvh;
    border-radius: 14px; padding: .4rem; box-shadow: 0 -6px 28px rgba(42,33,28,.28);
  }
  .more-menu-panel a, .more-menu-panel button { min-height: 48px; font-size: 1rem; }
}
/* Invoice "Mark paid" popover: never wider than the screen. */
.mark-paid-details > form { max-width: calc(100vw - 16px); }
.more-menu-panel a {
  display: flex; align-items: center; min-height: 44px; padding: 0 .8rem;
  border-radius: 8px; color: var(--ink); font-weight: 600;
}
.more-menu-panel a:hover { background: var(--cream); text-decoration: none; }
.contact-mini {
  position: fixed; left: 0; right: 0; top: 56px; z-index: 45;
  background: var(--cream); border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(42,33,28,.12);
}
.contact-mini[hidden] { display: none; }
.contact-mini-inner {
  max-width: 1100px; margin: 0 auto; padding: .25rem 1rem;
  display: flex; align-items: center; gap: .35rem;
}
.contact-mini-name {
  flex: 1; min-width: 0; font-weight: 700; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-height: 44px; display: flex; align-items: center;
}
.contact-mini-btn {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #fff; font-size: 1.1rem;
}
.contact-mini-btn.call { background: #1e6b3a; border-color: #1e6b3a; }
.contact-mini-btn:hover { text-decoration: none; filter: brightness(.97); }

/* Job detail: compact facts panel */
.job-facts { margin-bottom: .75rem; }
.acc-links { list-style: none; margin: 0; padding: 0; }
.acc-links li { border-top: 1px solid var(--line); }
.acc-links li:first-child { border-top: 0; }
.acc-links a { display: flex; align-items: center; min-height: 44px; padding: .3rem 0; }
.acc { scroll-margin-top: 120px; }

/* Quick Quality paid / unpaid (mirrors Vogl paid/unpaid on Income) */
.card-stat.on { border-color: var(--ember); box-shadow: inset 0 0 0 1px var(--ember); }
.card-stat-ok .n { color: var(--ok); }
.qq-cards a.card-stat { cursor: pointer; }
.qq-owed { color: var(--warn); font-weight: 700; }
.qq-allpaid { color: var(--ok); font-weight: 600; }
.qq-paid-amt { color: var(--ok); }
.qq-pick-pay { grid-template-columns: repeat(2, 1fr); }
.qq-pick-paid input:checked + span { background: var(--ok); border-color: var(--ok); }
.qq-pick-unpaid input:checked + span { background: #f8e8c8; border-color: #e8c48a; color: #7a4a00; }
.qq-paid-on[hidden] { display: none; }
.qq-seg { margin: 0 0 .5rem; max-width: none; }
.qq-seg-period .seg, .qq-seg-status .seg { min-width: 0; }
.qq-view-sum {
  display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline;
  margin: .25rem 0 .6rem; font-size: .92rem;
}
.qq-view-range { font-weight: 700; flex-basis: 100%; }
.qq-bulk {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem .75rem;
  background: #f7efe6; border: 1px solid var(--line); border-radius: 10px;
  padding: .6rem .75rem; margin-bottom: .75rem;
}
.qq-bulk-date { flex: 0 1 190px; }
.qq-bulk-date label { font-size: .8rem; }
.qq-bulk-btns { display: flex; flex-wrap: wrap; gap: .5rem; flex: 1 1 260px; }
.qq-bulk-btns .btn { min-height: 44px; }
.qq-bulk-links { display: flex; flex-wrap: wrap; gap: .35rem; flex-basis: 100%; }
.qq-bulk-links .btn { min-height: 40px; }
.qq-bulk .btn[disabled] { opacity: .5; cursor: not-allowed; }
.qq-tap-hint { font-size: .8rem; margin: 0 0 .25rem; }
.qq-row { grid-template-columns: auto 1fr auto auto; }
.qq-row[data-href] { cursor: pointer; }
.qq-row.is-unpaid { background: #fffaf0; }
.qq-row.selected { background: #fbefe0; box-shadow: inset 3px 0 0 var(--ember); }
.qq-sel {
  display: flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; margin: 0; cursor: pointer;
}
.qq-sel input { width: 1.3rem; height: 1.3rem; accent-color: var(--ember); margin: 0; }
.qq-row-actions { align-items: center; flex-wrap: wrap; }
.qq-pay-toggle {
  min-height: 40px; padding: .35rem .75rem; border-radius: 999px;
  font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; white-space: nowrap;
  border: 1px solid #e8c48a; background: #f8e8c8; color: #7a4a00;
  touch-action: manipulation; -webkit-tap-highlight-color: rgba(196,92,38,.2);
}
.qq-pay-toggle.paid { border-color: #a9d3b0; background: #d8f0dc; color: var(--ok); }
.qq-pay-toggle:active { transform: scale(.97); }
@media (max-width: 520px) {
  .qq-row { grid-template-columns: auto 1fr auto; }
  .qq-row-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .qq-seg-period { display: grid; grid-template-columns: repeat(3, 1fr); }
  .qq-seg-period .seg { border-bottom: 1px solid var(--line); }
  .qq-seg-period .seg:nth-child(3n) { border-right: 0; }
  .qq-seg-period .seg:nth-last-child(-n+3) { border-bottom: 0; }
  .qq-bulk-date { flex: 1 1 100%; }
  .qq-bulk-btns .btn { flex: 1 1 100%; }
}
/* Report: status column, paid/unpaid split, mark-range-paid */
.qq-report-controls .qq-seg-status { margin: .5rem 0 .75rem; }
.qq-report-table .qq-status-cell { font-size: .82rem; font-weight: 600; }
.qq-report-table .qq-status-cell.unpaid { color: var(--warn); }
.qq-report-table .qq-status-cell.paid { color: var(--ok); }
.qq-report-subtotals tfoot tr.qq-paid-split td { border-top: 0; font-weight: 600; font-size: .9rem; }
.qq-report-paid { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem; margin-top: .75rem; }
.qq-report-paid > div { flex: 0 1 180px; }
@media print {
  .qq-report-paid { display: none !important; }
}

/* Quick Quality: collapsible sections layout */
.qq-pay-cards { margin-bottom: .75rem; }
.qq-period-cards { margin-bottom: .75rem; }
.qq-period-cards .card-stat { padding: .75rem; }
.qq-period-cards .card-stat .n { font-size: 1.2rem; }
.acc .qq-form { margin-top: 0; }
.acc .qq-received { margin: .6rem 0 0; }
.acc .qq-bulk { margin-bottom: .5rem; }
.acc-body-head form { margin: 0; }
.qq-row-compact { grid-template-columns: 1fr auto auto; padding-left: .35rem; padding-right: .35rem; }
.qq-row-compact .qq-row-toggle { margin: 0; }
.qq-unpaid-list .qq-tag { margin-left: .25rem; vertical-align: 1px; }
.qq-site-list li[data-href] { cursor: pointer; }
@media (hover: hover) { .qq-site-list li[data-href]:hover { background: var(--cream); } }
.qq-report-links a { font-weight: 600; }
.qq-selbar {
  position: fixed; left: .5rem; right: .5rem; bottom: calc(.5rem + env(safe-area-inset-bottom, 0px));
  z-index: 50; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  max-width: 640px; margin: 0 auto; padding: .5rem .6rem .5rem .9rem;
  background: #2a211c; color: #fff; border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.qq-selbar[hidden] { display: none; }
.qq-selbar > span { flex: 1; font-size: .95rem; }
.qq-selbar .btn { min-height: 44px; }
.qq-selbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.qq-selbar .btn-secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
body.qq-has-selbar { padding-bottom: 5rem; }
@media (max-width: 520px) {
  .qq-row-compact { grid-template-columns: 1fr auto; }
  .qq-row-compact .qq-row-toggle { grid-column: 1 / -1; justify-self: end; }
  .qq-period-cards { grid-template-columns: repeat(3, 1fr); gap: .45rem; }
  .qq-period-cards .card-stat { padding: .6rem .5rem; }
  .qq-period-cards .card-stat .n { font-size: 1.02rem; }
  .qq-period-cards .card-stat .l { font-size: .74rem; }
}

/* ─── Partners: offers, pending calendar, partner portal (2026-10-08) ─── */
.prewrap { white-space: pre-wrap; }
.count-badge { display: inline-block; min-width: 1.5em; padding: .05rem .45rem; border-radius: 999px;
  background: #f0a500; color: #2a1a00; font-size: .8rem; font-weight: 700; text-align: center; vertical-align: middle; }
.nav-badge { display: inline-block; min-width: 1.3em; padding: 0 .35rem; margin-left: .2rem; border-radius: 999px;
  background: #f0a500; color: #2a1a00; font-size: .72rem; font-weight: 800; line-height: 1.35; text-align: center; }
.offer-badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; background: #fff3d6;
  color: #8a5300; border: 1.5px dashed #e09a00; font-size: .78rem; font-weight: 700; vertical-align: middle; }
.partner-chip { display: inline-block; padding: .12rem .55rem; border-radius: 999px; background: #e7f0fb;
  color: #1f4f86; font-size: .78rem; font-weight: 700; vertical-align: middle; }
.offer-list { display: grid; gap: .8rem; margin-bottom: 1rem; }
@media (min-width: 800px) { .offer-list { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } }
.offer-card { background: #fffbf0; border: 2px dashed #e09a00; border-radius: var(--radius); padding: .9rem 1rem;
  box-shadow: var(--shadow); }
.offer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .35rem; }
.offer-pay { font-size: 1.5rem; font-weight: 800; color: var(--ok); }
.offer-who { font-size: 1.05rem; margin-bottom: .3rem; }
.offer-line { margin: .2rem 0; font-size: .95rem; overflow-wrap: anywhere; }
.offer-desc { margin: .5rem 0; padding: .5rem .65rem; background: #fff; border-radius: 8px; border: 1px solid var(--line);
  white-space: pre-wrap; font-size: .92rem; }
.offer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .7rem; align-items: start; }
.offer-actions form, .offer-actions details { margin: 0; }
.btn-approve, .btn-decline { width: 100%; min-height: 52px; font-size: 1.1rem; font-weight: 800; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-approve { background: var(--ok); color: #fff; border: none; }
.btn-approve:hover { background: #24552d; color: #fff; }
.btn-decline { background: #fff; color: var(--bad); border: 2px solid var(--bad); list-style: none; }
.btn-decline::-webkit-details-marker { display: none; }
.offer-decline[open] { grid-column: 1 / -1; }
.offer-decline[open] > summary { display: none; }
.offer-decline-form { display: grid; gap: .5rem; }
.offer-decline-form textarea { width: 100%; }
.offer-foot { margin-top: .5rem; font-size: .8rem; }
.offer-panel h2 { display: flex; align-items: center; gap: .5rem; }
.cal-appt-actions .btn-approve, .cal-appt-actions .btn-decline { min-height: 44px; font-size: 1rem; width: auto; padding: 0 1rem; }
.cal-appt-actions form { display: inline; margin: 0; }

/* Calendar: pending partner offers = amber + dashed; approved partner jobs = blue edge */
.cal-appt-list li.cal-pending { background: repeating-linear-gradient(135deg, #fff8e6 0 12px, #fff3d6 12px 24px);
  border: 2px dashed #e09a00; border-radius: 10px; margin: .45rem 0; padding: 0 .35rem .45rem; }
.cal-appt-list li.cal-pending strong { color: #8a5300; }
.cal-appt-list li.cal-partner { border-left: 4px solid #3b7bd0; padding-left: .4rem; }
.cal-appt-site { font-size: .9rem; color: var(--ink); margin: .1rem 0; }
.cal-dot.has-pending { background: #f0a500; color: #2a1a00; outline: 2px dashed #b36f00; outline-offset: 1px; }
.cal-dot.busy { background: #9b8f86; color: #fff; }
.pending-banner { display: flex; align-items: center; gap: .55rem; padding: .75rem 1rem; margin: 0 0 1rem;
  background: #fff3d6; border: 2px dashed #e09a00; border-radius: var(--radius); color: #6b4100; font-weight: 700; }
.pending-banner:hover { text-decoration: none; background: #ffecc0; }

/* Partner state pills (admin + partner side) */
.pstate { display: inline-block; padding: .14rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.pstate-lg { font-size: .95rem; padding: .25rem .8rem; }
.pstate-pending { background: #fff3d6; color: #8a5300; border: 1.5px dashed #e09a00; }
.pstate-approved { background: #e3f1e5; color: var(--ok); }
.pstate-on_the_way { background: #e2ecfb; color: #1f4f86; }
.pstate-completed { background: #e9e4f6; color: #4b3a86; }
.pstate-declined, .pstate-canceled { background: #f6e3e3; color: var(--bad); }
.partner-job-panel .btn-row { margin-top: .75rem; }
.partner-visibility { font-size: .82rem; margin: .75rem 0 0; }
.partner-admin-actions { margin: .75rem 0; }
.partner-admin-actions form { margin: 0; }
.pw-once { border: 2px solid var(--ok); background: #f1faf2; }
.pw-code { font-size: 1.35rem; letter-spacing: .06em; padding: .2rem .5rem; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; user-select: all; overflow-wrap: anywhere; }

/* Shared notes */
.shared-notes { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .5rem; }
.shared-notes li { padding: .55rem .7rem; border-radius: 10px; background: #f7f3ee; border: 1px solid var(--line); }
.shared-notes li.sn-partner { background: #eef4fc; border-color: #cfe0f5; }
.sn-who { font-weight: 700; font-size: .85rem; margin-bottom: .15rem; }
.shared-note-form { display: grid; gap: .5rem; }
.shared-note-form textarea { width: 100%; }

/* ─── Partner portal (/partner) ─── */
.partner-body { background: var(--warm); }
.pt-top { background: #5c331f; color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.pt-top-inner { max-width: 960px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: .55rem .9rem; gap: .5rem; }
.pt-brand { display: flex; align-items: center; gap: .55rem; color: #fff; min-width: 0; }
.pt-brand:hover { text-decoration: none; }
.pt-brand img { border-radius: 8px; background: #fff; flex: none; }
.pt-brand span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.pt-brand small { opacity: .85; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-logout { margin: 0; }
.pt-link-btn { background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff; border-radius: 8px;
  padding: .45rem .7rem; font-size: .85rem; cursor: pointer; min-height: 40px; }
.pt-tabs { max-width: 960px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr 1.25fr; }
.pt-tabs a { color: #f6e6da; text-align: center; padding: .7rem .3rem; font-weight: 600; font-size: .95rem;
  border-bottom: 3px solid transparent; }
.pt-tabs a:hover { text-decoration: none; color: #fff; }
.pt-tabs a.active { color: #fff; border-bottom-color: var(--ember); }
.pt-tabs a.pt-tab-cta { color: #ffd9a8; }
.pt-wrap { max-width: 960px; padding-top: 1rem; padding-bottom: 2rem; }
.pt-foot { text-align: center; font-size: .8rem; padding: 1rem 0 2rem; }
.pt-login { max-width: 420px; margin: 1.5rem auto; text-align: center; }
.pt-login form { display: grid; gap: .35rem; text-align: left; margin-top: 1rem; }
.pt-login input { width: 100%; font-size: 1.05rem; padding: .7rem .75rem; }
.pt-login-logo { border-radius: 14px; }
.pt-login h1 { margin: .5rem 0 .2rem; }
.pt-big-btn { width: 100%; min-height: 52px; font-size: 1.1rem; font-weight: 700; margin-top: .75rem;
  display: flex; align-items: center; justify-content: center; }
.pt-small { font-size: .82rem; }
.pt-hello { display: grid; gap: .25rem; margin-bottom: .75rem; }
.pt-hello h1 { margin: 0; }
@media (min-width: 700px) { .pt-hello { grid-template-columns: 1fr 260px; align-items: center; } .pt-hello .pt-big-btn { margin: 0; } }
.pt-owed-box { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 10px;
  padding: .65rem .9rem; margin-bottom: 1rem; }
.pt-section { margin-bottom: 1.25rem; }
.pt-section h2 { font-size: 1.1rem; display: flex; align-items: center; gap: .5rem; }
.pt-cards { display: grid; gap: .65rem; }
@media (min-width: 700px) { .pt-cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }
.pt-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem .9rem; color: var(--ink); box-shadow: var(--shadow); min-height: 44px; }
.pt-card:hover { text-decoration: none; border-color: var(--ember); }
.pt-card-pending { border: 2px dashed #e09a00; background: #fffbf0; }
.pt-card-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.pt-card-pay { font-weight: 800; font-size: 1.15rem; color: var(--ok); }
.pt-card-title { font-weight: 700; font-size: 1.05rem; }
.pt-card-line { font-size: .92rem; margin-top: .15rem; overflow-wrap: anywhere; }
.pt-paid { color: var(--ok); font-weight: 700; }
.pt-owed { color: var(--warn); font-weight: 700; }
.pt-form { display: grid; gap: .3rem; }
.pt-form label { font-weight: 600; margin-top: .45rem; }
.pt-form input, .pt-form textarea { width: 100%; font-size: 1.02rem; padding: .65rem .7rem; }
.pt-two { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.pt-job h1 { margin: .4rem 0 .6rem; font-size: 1.35rem; }
.pt-otw { font-weight: 700; color: #1f4f86; }
.pt-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: .45rem; margin-bottom: .75rem; }
.pt-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.pt-photo-form { display: grid; gap: .5rem; }
.pt-day-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.pt-day-item { display: flex; gap: .75rem; align-items: center; padding: .7rem .8rem; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); min-height: 52px; }
a.pt-day-item:hover { text-decoration: none; border-color: var(--ember); }
.pt-day-item.pt-card-pending { border: 2px dashed #e09a00; background: #fffbf0; }
.pt-day-time { flex: none; width: 7.5rem; font-weight: 700; font-size: .9rem; }
.pt-busy { background: repeating-linear-gradient(135deg, #efebe7 0 10px, #e7e1db 10px 20px); color: var(--muted); }
.pt-busy .pt-day-what { font-weight: 700; }
.btn-approve, .btn-decline { white-space: nowrap; }

/* ─── Busy blocks (non-job calendar time) ─── */
.busy-list { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .45rem; }
.busy-item { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .65rem .75rem; min-height: 52px;
  border-radius: 10px; border: 1px solid #cfc6bf; color: var(--ink);
  background: repeating-linear-gradient(135deg, #efebe7 0 10px, #e4ddd6 10px 20px); }
.busy-item:hover { text-decoration: none; border-color: var(--muted); }
.busy-time { flex: none; font-weight: 700; font-size: .88rem; min-width: 5.5rem; }
.busy-what { flex: 1 1 10rem; min-width: 0; display: flex; flex-direction: column; }
.busy-note { font-size: .82rem; }
.busy-sync { flex: none; font-size: .75rem; font-weight: 700; padding: .12rem .5rem; border-radius: 999px;
  background: #fff3d6; color: #8a5300; }
.busy-sync.on { background: #e3f1e5; color: var(--ok); }
.cal-day.has-block { background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(120,110,100,.12) 6px 12px); }
.cal-dot.cal-dot-block { background: transparent; font-size: .7rem; }
.bb-hint { font-size: .82rem; margin: .2rem 0; }
.bb-sync { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.bb-sync input[type=date] { max-width: 11rem; }

/* Request Google review */
.review-req { margin-top: .9rem; padding-top: .8rem; border-top: 1px dashed var(--line); }
.review-req-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.review-done { font-size: .8rem; font-weight: 700; padding: .12rem .55rem; border-radius: 999px; background: #e3f1e5; color: var(--ok); }
.review-note { font-size: .8rem; margin-top: .35rem; }
.review-req .quick-tap-grid { grid-template-columns: 1fr 1fr; }
.review-req .is-disabled { opacity: .45; pointer-events: none; }
.review-wrap { padding: 0 .9rem .9rem; }

/* Parts catalog */
.cat-warn { font-size: .85rem; }
.cat-filters { display: grid; gap: .6rem; }
.cat-q { width: 100%; font-size: 1.05rem; padding: .75rem .8rem; }
.cat-filter-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.cat-filter-row select { flex: 1 1 8.5rem; min-height: 44px; }
.cat-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .6rem; }
.cat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cat-card-head { display: block; padding: .75rem .9rem; color: var(--ink); }
.cat-card-head:hover { text-decoration: none; background: #fffaf5; }
.cat-title { font-size: 1.05rem; overflow-wrap: anywhere; }
.cat-sub { font-size: .85rem; margin: .1rem 0 .3rem; }
.cat-best-line { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.cat-cost { font-weight: 800; font-size: 1.15rem; color: var(--ok); }
.cat-lbl { font-size: .78rem; }
.cat-tag { display: inline-block; padding: .08rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: #eee7df; color: var(--muted); }
.cat-tag-stock { background: #e3f1e5; color: var(--ok); }
.cat-tag-out { background: #f6e3e3; color: var(--bad); }
.cat-tag-cfp { background: #fff3d6; color: #8a5300; }
.cat-tag-best { background: var(--ok); color: #fff; }
.cat-more { border-top: 1px solid var(--line); padding: 0 .9rem .6rem; }
.cat-more > summary { cursor: pointer; padding: .6rem 0; font-weight: 600; color: var(--ember-dark); min-height: 44px; display: flex; align-items: center; }
.cat-offer { padding: .55rem .6rem; border: 1px solid var(--line); border-radius: 10px; margin: .4rem 0; background: #fcfaf7; }
.cat-offer.cat-best { border-color: var(--ok); background: #f1faf2; }
.cat-offer-nums { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .2rem 0; }
.cat-offer-links { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.cat-btn { min-height: 44px; display: inline-flex; align-items: center; }
.cat-add { display: flex; gap: .4rem; align-items: center; margin: 0; }
.cat-add input { width: 4.5rem; min-height: 44px; }
.cat-updated { font-size: .75rem; }
.cat-notstocked { padding: .5rem .7rem; background: #f6e3e3; border-radius: 10px; }
.cat-pager { justify-content: center; }
.job-margin { display: grid; gap: .25rem; padding: .6rem .75rem; margin-bottom: .6rem; background: #f7f3ee; border-radius: 10px; }
.margin-bad { color: var(--bad); }

/* catalog: branches */
.cat-stockline { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.cat-branch { font-size: .82rem; padding: .12rem .55rem; border-radius: 999px; background: #eee7df; color: var(--muted); }
.cat-branch-in { background: #e3f1e5; color: var(--ok); }
.cat-branch-out { background: #f6e3e3; color: var(--bad); }
.cat-branch-near { font-size: .92rem; font-weight: 700; order: -1; outline: 2px solid currentColor; outline-offset: -2px; }
.cat-tag-near { background: var(--ember-dark, #b5481a); color: #fff; }
.cat-sib { font-size: .78rem; margin-top: .2rem; }

/* Calendar: swipe + month dropdown */
#cal-a, #cal-b, #cal-month { touch-action: pan-y pinch-zoom; }
.cal-loading { opacity: .6; transition: opacity .15s; }  /* month grid only */
#cal-root { position: relative; }
#cal-root.cal-busy::before { content: ''; position: fixed; left: 0; top: 0; height: 3px; width: 40%; background: #c2410c; z-index: 50; animation: calBar 1s ease-in-out infinite; }
@keyframes calBar { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes calInRight { from { opacity: .55; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes calInLeft  { from { opacity: .55; transform: translateX(-22px); } to { opacity: 1; transform: none; } }
@keyframes calInFade  { from { opacity: .55; } to { opacity: 1; } }
.cal-in-right { animation: calInRight .22s ease-out; }
.cal-in-left  { animation: calInLeft .22s ease-out; }
.cal-in-fade  { animation: calInFade .2s ease-out; }
@media (prefers-reduced-motion: reduce) { .cal-in-right, .cal-in-left, .cal-in-fade { animation: none; } }
.cal-month-toggle { display: inline-flex; align-items: center; gap: .25rem; margin-left: .45rem; min-height: 40px; padding: .3rem .7rem;
  border: 1px solid var(--line, #d9d4cc); border-radius: 999px; background: #fff; font: inherit; font-size: .85rem; font-weight: 600; color: inherit; cursor: pointer; }
.cal-month-toggle .chev { transition: transform .2s; display: inline-block; }
.cal-month-toggle.open .chev { transform: rotate(180deg); }
.cal-month { padding: .6rem .5rem .7rem; }
.cal-month[hidden] { display: none; }
.cal-month-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .4rem; }
.cal-month-title { font-weight: 700; font-size: 1.05rem; text-align: center; flex: 1; }
.cal-month-dow, .cal-month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-month-dow span { text-align: center; font-size: .72rem; font-weight: 700; color: #7a7266; padding: .15rem 0; }
.cal-mcell { position: relative; min-height: 48px; border: 1px solid transparent; border-radius: 10px; background: #faf8f4; font: inherit; color: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 2px; cursor: pointer; }
.cal-mcell.out { opacity: .42; }
.cal-mcell.today { border-color: #c2410c; }
.cal-mcell.selected { background: #c2410c; color: #fff; }
.cal-mnum { font-size: .98rem; font-weight: 600; line-height: 1; }
.cal-mdots { display: flex; gap: 3px; min-height: 8px; }
.md { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.md-job { background: #2f6f4f; } .md-pend { background: #d97706; } .md-block { background: #6b7280; border-radius: 2px; }
.cal-mcell.selected .md { box-shadow: 0 0 0 1.5px #fff; }
.cal-month-legend { display: flex; flex-wrap: wrap; gap: .2rem .9rem; align-items: center; font-size: .75rem; margin-top: .5rem; }
.cal-month-legend .md { margin-right: .25rem; }
.cal-month-today { margin-left: auto; min-height: 36px; padding: .2rem .8rem; border: 1px solid var(--line, #d9d4cc); border-radius: 999px; background: #fff; font: inherit; font-size: .8rem; cursor: pointer; }
.cal-week-label { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; }

/* Calendar: free-scrolling day strip */
.cal-days.cal-strip { display: flex; gap: .35rem; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain; overflow-anchor: none; scrollbar-width: none; padding: 2px 1px 4px; position: relative; touch-action: pan-x pan-y; }
.cal-strip::-webkit-scrollbar { display: none; }
.cal-strip .cal-day { flex: 0 0 calc((100% - 6 * .35rem) / 7); min-width: 48px; }
.cal-mon { flex: 0 0 auto; align-self: stretch; display: flex; align-items: center; justify-content: center; min-width: 26px; padding: 0 .1rem;
  font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #c2410c; writing-mode: vertical-rl; transform: rotate(180deg);
  border-left: 2px solid #e8cdb8; }

/* multi-option estimate editor (admin) */
.badge.void { background: #e6e1dc; color: #6b5a4e; text-decoration: line-through; }
.opt-edit { border-left: 4px solid #5c331f; margin-top: .9rem; }
.check-row { display: flex; align-items: center; gap: .5rem; font-weight: 600; min-height: 2.6rem; }
.check-row input { width: 1.3rem; height: 1.3rem; }
.opt-edit .lines-box h4 { font-size: .95rem; }

/* job page: per-option editor (options estimate not yet approved) */
.job-opts-lead { margin: 0 0 .75rem; }
.opt-tabs { display: flex; gap: .4rem; overflow-x: auto; margin: .75rem 0 0; padding-bottom: .2rem; }
.opt-tab { flex: 1 0 auto; min-height: 2.9rem; padding: .4rem .8rem; border: 1px solid var(--line, #e0d2c5); border-radius: .6rem; background: #fff; font: inherit; font-weight: 700; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.opt-tab.is-on { background: #5c331f; color: #fff; border-color: #5c331f; }
.opt-tab-sum { font-size: .75rem; font-weight: 500; opacity: .85; }
.opt-pane[hidden] { display: none; }
.job-opts .part-row { border-top: 1px dashed var(--line, #e0d2c5); padding-top: .4rem; }
.job-opts .opt-pane { margin-top: .6rem; }

/* ── Simplified job / estimate pages: nested collapsibles (20261011d) ── */
.pb-picker[hidden] { display: none; }
.acc .pb-picker-list { position: static; max-height: 14rem; margin-top: .3rem; }
.job-sum { padding: .8rem 1rem; }
.job-sum-line { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.job-sum-name { font-weight: 800; font-size: 1.1rem; color: var(--ink); }
.job-sum-when { margin: .1rem 0 .3rem; font-size: .92rem; }
.job-sum .field-address { margin: 0 0 .6rem; }
.job-sum .quick-tap-grid { grid-template-columns: 1fr 1fr; }
.job-sum .field-primary { margin-bottom: .5rem; }
.job-sum .field-msgs { margin-bottom: 0; }
.more-menu-panel form { margin: 0; }
.more-menu-panel button {
  display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 .8rem; border: 0;
  border-radius: 8px; background: none; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-align: left;
}
.more-menu-panel button:hover { background: var(--cream); }
.more-menu-panel .mm-danger { color: var(--bad); }
.more-menu-panel a .badge { margin-left: .4rem; }
.job-opts { margin: 0 0 .65rem; }
.job-opts-links { margin: .1rem 0 .7rem; font-size: .85rem; }
.job-opts .table-wrap { margin: 0; }
.acc-opt > .acc-sum { min-height: 60px; }
.acc-opt > .acc-body { padding: .5rem .6rem .7rem; }
.acc-sub2 { box-shadow: none; border-radius: 10px; margin-bottom: .45rem; background: #fffdfa; }
.acc-sub2 > .acc-sum { min-height: 48px; padding: .4rem .8rem; }
.acc-sub2 .acc-title { font-size: .95rem; }
.acc-sub2 > .acc-body { padding: .6rem .7rem .8rem; }
.opt-h { margin: .2rem 0 .35rem; font-size: .92rem; }
.opt-h .muted { font-weight: 400; font-size: .8rem; }
.opt-save { margin-top: .6rem; }
.opt-save .btn { width: 100%; min-height: 48px; }
.job-opts .part-row { border-top: 1px dashed var(--line, #e0d2c5); padding-top: .4rem; }
.est-sum dl { margin: 0; }
/* pb-parts 20261011e */

/* Upcoming jobs + canceled lists (20261011f) */
.upcoming-list, .cancel-list { display: flex; flex-direction: column; }
.upcoming-row, .cancel-row { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; padding: .7rem .2rem; min-height: 48px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.upcoming-row:last-child, .cancel-row:last-child { border-bottom: 0; }
.upcoming-row .up-main { flex: 1 1 11rem; display: flex; flex-direction: column; min-width: 0; }
.upcoming-row .up-when { display: flex; flex-direction: column; align-items: flex-end; font-size: .9rem; gap: .15rem; }
.cancel-row { flex-direction: column; align-items: flex-start; }
.cancel-why { font-size: .92rem; }
.canceled-fold { margin-top: 1rem; }
.canceled-fold summary { cursor: pointer; padding: .6rem 0; font-weight: 600; min-height: 44px; }

/* New-lead banner */
.lead-banner {
  background: #fff3e0; color: var(--ink); border-bottom: 3px solid var(--ember);
  padding: .6rem 1rem; position: sticky; top: var(--nav-h); z-index: 45;
  box-shadow: 0 2px 10px rgba(42,33,28,.15);
}
.lead-banner[hidden] { display: none; }
.lead-banner-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }
.lead-banner-tools { display: flex; gap: .75rem; align-items: center; font-size: .9rem; }
.lead-banner-tools form, .lead-banner-list form { margin: 0; }
.lead-banner-sound { display: flex; gap: .3rem; align-items: center; color: var(--muted); }
.lead-banner-list { list-style: none; margin: .4rem 0 0; padding: 0; }
.lead-banner-list li { display: flex; gap: .6rem; align-items: center; justify-content: space-between; padding: .35rem 0; border-top: 1px solid #f0d9bd; }
.lead-banner-list a { color: var(--ember-dark); text-decoration: none; line-height: 1.35; min-width: 0; overflow-wrap: anywhere; }
.lead-banner-list small, .lb-snip { color: var(--muted); }
@media (max-width: 520px) { .lead-banner { padding: .5rem .75rem; } .lb-snip { display: none; } }
@media print { .lead-banner { display: none !important; } }

/* Drive time from here (job page + calendar day) */
.drive-time-out { margin: 0.5rem 0; padding: 0.5rem 0.7rem; border-radius: 8px; background: rgba(46, 125, 50, 0.08); font-size: 0.95rem; line-height: 1.4; }
.drive-time-out.drive-time-err { background: rgba(198, 40, 40, 0.08); }

/* 2026-10-26: phone calendar action rows (pending-offer Approve/Decline row too) — keep after the rules above */
@media (max-width: 560px) {
  .cal-appt-actions form { display: block; }
  .cal-appt-actions .btn-approve, .cal-appt-actions .btn-decline { width: 100%; padding: 0 .4rem; font-size: .92rem; }
}

/* Income: period-aware summary boxes (mirrors Ledger month scope) — 2026-11-01 */
.income-scope { margin-top: .25rem; }
.income-scope-step {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; min-height: 36px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 1.25rem; font-weight: 700; line-height: 1; text-decoration: none;
}
.income-scope-step:hover { background: var(--cream); text-decoration: none; }
.income-scope-step.is-off { opacity: .35; }
.income-scope-now { font-size: .85rem; font-weight: 600; }
.income-period.is-selected { border-left: 3px solid var(--ember); padding-left: .6rem; }

/* Income: period groups as collapsible dropdowns (acc look; mobile-friendly tap target) */
details.income-period { margin-bottom: .6rem; }
details.income-period > summary.income-period-head { align-items: center; margin: 0; border-bottom: 0; flex-wrap: nowrap; }
details.income-period .acc-title { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; width: 100%; }
details.income-period .acc-head { flex: 1; min-width: 0; }
details.income-period .acc-body { padding-top: .4rem; }


/* ETA to next job / from shop (calendar day, any date) */
.eta-next-out.eta-tight { background: rgba(230, 126, 34, 0.14); }
.eta-next-out .eta-warn { display: block; margin-top: .25rem; color: #9a4b00; font-size: .9rem; }


/* Find a slot near… (calendar) */
.slot-finder {
  margin: 0 0 1rem;
  padding: .85rem .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdfa;
}
.slot-finder label[for="slot-finder-q"] {
  display: block; font-weight: 700; margin-bottom: .35rem;
}
#slot-finder-q {
  width: 100%; min-height: 48px; font-size: 1.05rem;
  padding: .55rem .75rem; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.slot-finder-opts {
  display: flex; flex-wrap: wrap; gap: .6rem .75rem;
  align-items: flex-end; margin-top: .65rem;
}
.slot-finder-length { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; font-weight: 600; }
.slot-finder-length select {
  min-height: 44px; min-width: 7.5rem; font: inherit; font-weight: 500;
  padding: 0 .5rem; border-radius: 8px; border: 1px solid var(--line); background: #fff;
}
.slot-finder-buffer {
  display: flex; flex-direction: column; gap: .25rem;
  flex: 1 1 11rem; min-width: 10rem; font-size: .85rem; font-weight: 600;
}
#slot-finder-buffer {
  width: 100%; min-height: 44px; margin: 0; accent-color: var(--ember, #c45c26);
}
.slot-finder-opts .btn { min-height: 44px; min-width: 6.5rem; }
.slot-finder-services {
  display: flex; flex-wrap: wrap; gap: .4rem;
  margin-top: .65rem;
}
.sf-svc {
  display: inline-flex; align-items: center; gap: .25rem;
  min-height: 40px; padding: .25rem .6rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; font: inherit; font-size: .82rem; font-weight: 600;
  color: var(--ink); cursor: pointer;
}
.sf-svc.is-on {
  background: var(--cream, #f6efe6);
  border-color: var(--ember, #c45c26);
  color: var(--ember-dark, #9a4b00);
}
.sf-svc-qty {
  display: inline-flex; align-items: center; gap: .1rem;
  margin-left: .15rem; font-weight: 700;
}
.sf-svc-qty button {
  width: 1.5rem; height: 1.5rem; padding: 0;
  border: 0; border-radius: 999px;
  background: transparent; color: inherit; font: inherit; font-weight: 700;
  cursor: pointer;
}
.sf-breakdown { margin: .45rem 0 0; font-size: .85rem; color: var(--muted); }
.slot-finder-status { margin: .65rem 0 0; font-size: .92rem; }
.slot-finder-status.is-err { color: var(--bad, #9a2a2a); }
.slot-finder-results {
  list-style: none; margin: .4rem 0 0; padding: 0;
}
.slot-finder-day {
  display: flex; flex-direction: column; gap: .25rem;
  padding: .75rem 0; border-top: 1px solid var(--line);
}
.slot-finder-day.is-best .sf-when { color: var(--ember-dark, #9a4b00); }
.sf-when { font-weight: 700; line-height: 1.35; }
.sf-near, .sf-note { color: var(--muted); font-size: .9rem; line-height: 1.35; }
.sf-badge {
  display: inline-block; margin-left: .35rem; padding: .05rem .4rem;
  border-radius: 999px; background: var(--cream, #f6efe6);
  color: var(--muted); font-size: .75rem; font-weight: 600;
}
.slot-finder-day .btn { min-height: 44px; margin-top: .35rem; align-self: flex-start; }
.slot-finder-caveat { margin: .55rem 0 0; font-size: .82rem; }
.slot-finder-day.is-tight .sf-when { font-weight: 600; }

.sf-timeline {
  display: flex;
  flex-direction: column;
  gap: .12rem;
  margin: .4rem 0 .1rem;
  padding: .55rem .7rem .55rem .85rem;
  border-left: 3px solid var(--ember, #c45c26);
  border-radius: 0 8px 8px 0;
  background: var(--cream, #f6efe6);
  font-size: .88rem;
  line-height: 1.3;
}
.sf-tl-job { font-weight: 650; }
.sf-tl-open { font-weight: 500; color: var(--muted); }
.sf-tl-meta { color: var(--muted); font-size: .82rem; font-weight: 500; }
.sf-tl-drive { color: var(--muted); font-size: .82rem; padding: .12rem 0 .12rem .05rem; }
.sf-tl-slot { font-weight: 700; padding-top: .12rem; }
.sf-tl-usable { font-weight: 650; color: var(--ink, #2a211c); font-size: .86rem; padding-bottom: .12rem; }

.badge.needs-details {
  background: #fde8c8;
  color: #8a4b00;
  font-weight: 700;
}
.sf-hold-sheet {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: flex-end; justify-content: center;
}
.sf-hold-sheet[hidden] { display: none; }
.sf-hold-backdrop {
  position: absolute; inset: 0; background: rgba(42, 33, 28, .45);
}
.sf-hold-panel {
  position: relative; z-index: 1;
  width: 100%; max-width: 28rem;
  background: #fffdfa; color: var(--ink, #2a211c);
  border-radius: 16px 16px 0 0;
  padding: 1.15rem 1.1rem 1.4rem;
  box-shadow: 0 -8px 28px rgba(42, 33, 28, .18);
}
.sf-hold-x {
  position: absolute; top: .55rem; right: .55rem;
  width: 44px; height: 44px; border: 0; background: transparent;
  font-size: 1.6rem; line-height: 1; color: var(--muted, #6b5e55); cursor: pointer;
}
.sf-hold-panel h2 { margin: 0 2.2rem .35rem 0; font-size: 1.25rem; }
.sf-hold-when { margin: 0 0 .85rem; color: var(--muted, #6b5e55); font-size: .95rem; }
.sf-hold-panel label { display: block; font-weight: 700; margin-bottom: .35rem; }
#sf-hold-name {
  width: 100%; min-height: 52px; font-size: 1.15rem;
  padding: .65rem .8rem; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink, #2a211c);
}
.sf-hold-save {
  display: block; width: 100%; min-height: 52px; margin-top: .85rem;
  font-size: 1.1rem; font-weight: 700;
}
.sf-hold-err { margin: .55rem 0 0; color: var(--bad, #9a2a2a); font-size: .92rem; }
.sf-hold-full {
  display: inline-block; margin-top: .7rem; font-size: .88rem; color: var(--muted, #6b5e55);
}
.sf-hold-done p { margin: 0 0 .85rem; font-size: 1.05rem; line-height: 1.4; }
.sf-hold-done .btn { display: block; width: 100%; min-height: 48px; margin-top: .5rem; text-align: center; }
@media (min-width: 640px) {
  .sf-hold-sheet { align-items: center; }
  .sf-hold-panel { border-radius: 16px; margin: 1rem; }
}


/* Lead activity timeline + add-note form */
.lead-last-contact { margin-top: .15rem; font-size: .82rem; }
.lead-activity-panel { margin-top: 1rem; }
.lead-note-form {
  display: flex; flex-direction: column; gap: .6rem;
  margin: 0 0 1.1rem; padding: .85rem .9rem;
  background: var(--cream, #faf7f2);
  border: 1px solid var(--line); border-radius: 10px;
}
.lead-note-fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: .6rem;
}
.lead-note-form label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .85rem; }
.lead-note-form select,
.lead-note-form input[type="datetime-local"],
.lead-note-form textarea {
  font: inherit; font-weight: 400; min-height: 44px;
  padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; width: 100%; box-sizing: border-box;
}
.lead-note-form textarea { min-height: 5.5rem; resize: vertical; }
.lead-note-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.lead-note-actions .btn { min-height: 44px; min-width: 7rem; }
.lead-notes-fallback { margin-top: 1rem; }
.lead-notes-fallback pre {
  white-space: pre-wrap; font: inherit; font-size: .9rem;
  background: var(--cream, #faf7f2); padding: .65rem .75rem;
  border-radius: 8px; border: 1px solid var(--line); overflow: auto;
}
.timeline-item.timeline-system .timeline-meta strong { color: var(--muted); font-weight: 600; }
.timeline-item.timeline-kind-imported .timeline-detail { font-style: inherit; }
@media (max-width: 700px) {
  .lead-note-fields { grid-template-columns: 1fr; }
}
