/* ── Reset & base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-light: #eff6ff;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --white: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── App header (logo) ────────────────────────────── */
.app-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1rem;
  text-align: center;
}
.header-logo {
  height: 38px;
  width: auto;
  display: inline-block;
}

/* ── Nav ──────────────────────────────────────────── */
.nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.nav-links { display: flex; align-items: center; gap: .25rem; }

.nav-mini-icon {
  height: 26px;
  width: auto;
  display: block;
  margin-right: .25rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  padding: .4rem .75rem;
  border-radius: 8px;
  transition: background .15s, color .15s;
}

.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: #eff6ff; color: var(--brand); }

.nav-signout {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: .8rem;
  color: var(--text-muted);
  padding: .35rem .5rem;
  border-radius: 6px;
  transition: color .15s;
}
.nav-signout:hover { color: var(--text); }

.nav-account {
  display: flex;
  align-items: center;
  gap: .15rem;
  margin-left: .5rem;
}

.nav-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: .38rem;
  border-radius: 8px;
  transition: background .15s, color .15s;
  text-decoration: none;
  line-height: 1;
}
.nav-icon-btn:hover { background: var(--bg); color: var(--text); }
.nav-icon-btn.active { background: #eff6ff; color: var(--brand); }

/* ── User account dropdown ────────────────────────── */
.user-menu-wrap { position: relative; }

.user-menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.13);
  min-width: 158px;
  z-index: 300;
  padding: .3rem 0;
  outline: none;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .9rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background .1s;
  white-space: nowrap;
}
.user-menu-item:hover { background: var(--bg); }
.user-menu-item-active { color: var(--brand); }
.user-menu-signout { color: var(--danger); }
.user-menu-divider { height: 1px; background: var(--border); margin: .3rem 0; }

/* ── Main layout ──────────────────────────────────── */
.page { max-width: 680px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.page-title { font-size: 1.4rem; font-weight: 700; }

/* ── Cards ────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  padding: .55rem 1.1rem;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, opacity .15s, box-shadow .15s;
  white-space: nowrap;
}

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg); color: var(--text); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: .35rem .6rem;
}
.btn-ghost:hover { background: var(--bg); }

.btn-sm { padding: .35rem .7rem; font-size: .8125rem; }
.btn-xs { padding: .18rem .45rem; font-size: .75rem; }
.btn-lg { padding: .7rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-danger-outline { color: var(--danger); border-color: rgba(220,38,38,.3); }
.btn-danger-outline:hover { background: #fef2f2; color: var(--danger); border-color: var(--danger); }

/* ── Forms ────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .35rem;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: .6rem .8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9375rem;
  color: var(--text);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  font-family: inherit;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

textarea { resize: vertical; }

.form-error {
  color: var(--danger);
  font-size: .8125rem;
  margin-top: .25rem;
}

/* ── Login page ───────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--brand-light) 0%, var(--white) 60%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 2.25rem 2rem;
}

.login-logo {
  margin-bottom: .5rem;
  text-align: center;
}
.login-logo-img {
  max-width: 200px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.login-tagline {
  text-align: center;
  color: var(--text-muted);
  font-size: .875rem;
  margin-bottom: 1.75rem;
}

/* ── Status badges ────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-approved { background: var(--success-bg); color: var(--success); }
.badge-declined { background: var(--danger-bg); color: var(--danger); }
.badge-paid { background: #d1fae5; color: #065f46; }
.badge-unpaid { background: #fee2e2; color: #991b1b; }
.badge-expired { background: #fde8d8; color: #9a3412; }
.badge-expiry { background: #ecfdf5; color: #065f46; }

.undo-paid-btn { color: var(--text-muted); font-size: .75rem; }
.flag-unpaid-btn { color: var(--danger); }
.pay-badges { display: flex; gap: .35rem; align-items: center; min-height: 1.25rem; }

/* ── Earnings bar ─────────────────────────────────── */
.earnings-bar {
  display: flex;
  align-items: stretch;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  overflow: hidden;
}

.earnings-item {
  flex: 1;
  padding: .75rem 1rem;
  text-align: center;
}

.earnings-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.earnings-label {
  font-size: .7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: .15rem;
}

.earnings-divider {
  width: 1px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Filter / search bar ──────────────────────────── */
.filter-section {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.filter-bar {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
}

.filter-tab {
  padding: .3rem .7rem;
  border-radius: 20px;
  font-size: .8125rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  background: var(--white);
  border: 1px solid var(--border);
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}

.filter-tab:hover { background: var(--bg); color: var(--text); }
.filter-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.search-form {
  display: flex;
  gap: .4rem;
  align-items: center;
}

.search-input {
  flex: 1;
  padding: .45rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}

.search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ── Expiry text colours (detail page) ────────────── */
.expiry-active { color: var(--success); font-weight: 500; }
.expiry-expired { color: var(--danger); font-weight: 500; }

/* ── Quote list ───────────────────────────────────── */
.quote-list { display: flex; flex-direction: column; gap: .75rem; }

.quote-item {
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.quote-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}

.quote-customer { font-weight: 600; font-size: 1rem; }
.quote-vehicle { font-size: .8rem; color: var(--brand); font-weight: 500; margin-top: .1rem; }
.quote-meta { font-size: .8125rem; color: var(--text-muted); }

.quote-item-address {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding-top: .5rem;
}

.quote-item-address-text {
  font-size: .8375rem;
  color: var(--text-muted);
}

.quote-item-bottom {
  display: flex;
  align-items: center;
}

.quote-total { font-size: 1rem; font-weight: 700; color: var(--text); }

.quote-pay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  border-top: 1px solid var(--border);
  padding-top: .5rem;
}

.quote-pay-actions { display: flex; gap: .4rem; align-items: center; }

.quote-share-row {
  display: flex;
  gap: .4rem;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: .5rem;
}
.quote-share-left {
  display: flex;
  gap: .4rem;
  align-items: center;
  flex-wrap: wrap;
}
.review-req-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.quote-actions { display: flex; gap: .4rem; align-items: center; }

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

.empty-state h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: .4rem; color: var(--text); }
.empty-state p { font-size: .9rem; margin-bottom: 1.25rem; }

/* ── Create quote ─────────────────────────────────── */
.section-title {
  font-size: .8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}

.create-form { padding: 1.25rem; }

.vehicle-row {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

.vehicle-year-group { flex: 0 0 6rem; }
.vehicle-make-group { flex: 1 1 8rem; }
.vehicle-model-group { flex: 1 1 8rem; }

.vehicle-year-select,
.vehicle-make-select,
.vehicle-model-select {
  width: 100%;
  padding: .55rem 2.2rem .55rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: .9rem;
  color: var(--text);
  background-color: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  background-size: .7rem;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  font-family: inherit;
  outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: border-color .15s, box-shadow .15s;
  cursor: pointer;
  min-height: 42px;
}

.vehicle-year-select:focus,
.vehicle-make-select:focus,
.vehicle-model-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.vehicle-year-select:disabled,
.vehicle-make-select:disabled,
.vehicle-model-select:disabled {
  background-color: var(--bg);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: .7;
}

/* ── Customer search bar ─────────────────────────── */
.csearch-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  transition: border-color .15s, box-shadow .15s;
}
.csearch-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.csearch-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  display: flex;
  pointer-events: none;
  flex-shrink: 0;
}
.csearch-wrap input[type="text"] {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  padding: .8rem 1rem .8rem 2.75rem;
  font-size: 1rem;
  color: var(--text);
  font-family: inherit;
  min-width: 0;
  -webkit-appearance: none;
  border-radius: 14px;
}
.csearch-wrap input[type="text"]::placeholder { color: var(--text-muted); }
.csearch-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 100%;
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  border-radius: 0 14px 14px 0;
  transition: color .15s;
}
.csearch-clear:hover { color: var(--text); }

.line-items-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}

.line-item-row {
  display: grid;
  grid-template-columns: 1fr 58px 90px auto;
  gap: .5rem;
  align-items: center;
  margin-bottom: .5rem;
}

.item-qty-input { text-align: center; }
.line-item-row input[type="number"],
.line-item-row .item-desc-input { width: 100%; min-width: 0; }

/* ── Customer picker dialog ────────────────────────── */
/* Overlay backdrop — works in all browsers including Safari */
.cpicker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-overflow-scrolling: touch;
}
.cpicker-dialog {
  display: flex;
  flex-direction: column;
  width: min(90vw, 420px);
  max-height: 72vh;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  overflow: hidden;
  background: #fff;
}

.cpicker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1rem .75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cpicker-title { font-weight: 700; font-size: 1rem; }
.cpicker-close-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.4rem; color: var(--text-muted); line-height: 1;
  padding: .1rem .35rem; border-radius: 4px;
}
.cpicker-close-btn:hover { background: var(--bg); color: var(--text); }

.cpicker-search-wrap {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cpicker-search {
  width: 100%; padding: .5rem .75rem;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: .9rem; font: inherit; outline: none;
}
.cpicker-search:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }

.cpicker-results { overflow-y: auto; flex: 1; padding: .3rem 0; }

.cpicker-row {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; text-align: left; gap: .75rem;
  background: none; border: none; cursor: pointer;
  padding: .65rem 1rem; transition: background .1s;
}
.cpicker-row:hover { background: var(--bg); }
.cpicker-name { font-weight: 600; font-size: .9rem; color: var(--text); }
.cpicker-phone { font-size: .82rem; color: var(--text-muted); flex-shrink: 0; }
.cpicker-empty {
  padding: 1.75rem 1rem; text-align: center;
  color: var(--text-muted); font-size: .88rem;
}

/* ── Customer phone suggestion ────────────────────── */
.customer-suggestion {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .45rem;
  padding: .55rem .75rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: .84rem;
  color: var(--text);
  animation: fadeIn .15s ease;
}
.csugg-label { color: var(--text-muted); }
.csugg-name  { font-weight: 600; }
.csugg-btn {
  margin-left: auto;
  background: var(--brand);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 600;
  padding: .28rem .65rem;
  border-radius: 6px;
  transition: opacity .15s;
}
.csugg-btn:hover { opacity: .88; }

/* Column headers for line items */
.li-col-headers {
  display: grid;
  grid-template-columns: 1fr 58px 90px auto;
  gap: .5rem;
  margin-bottom: .25rem;
  padding: 0 0 .15rem;
}
.li-col-headers span {
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.li-col-qty, .li-col-price { text-align: center; }

/* Qty label on existing items */
.item-qty-label {
  display: block;
  font-size: .74rem;
  color: var(--text-muted);
  margin-top: .1rem;
}

.remove-item-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: .25rem;
  border-radius: 4px;
  transition: color .15s;
}

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

/* ── Tax rate input ──────────────────────────────── */
.tax-rate-form-group {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .75rem;
}
.tax-rate-label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  margin: 0;
}
.tax-rate-input {
  width: 90px;
  text-align: center;
}

/* ── Controls row & wrappers ─────────────────────── */
/* display:contents = invisible wrapper; children slot directly into the row's grid */
.li-controls-row  { display: contents; }
.item-ctrl-wrap   { display: contents; }
.item-ctrl-label  { display: none; font-size: .63rem; font-weight: 600;
                    color: var(--text-muted); text-transform: uppercase;
                    letter-spacing: .05em; white-space: nowrap; }

/* ── Taxable checkbox in line item rows ──────────── */
.item-taxable-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
}
.item-taxable-cb {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--brand);
  margin: 0;
}
.li-col-taxable { text-align: center; }

/* ── Tax breakdown rows ──────────────────────────── */
#tax-breakdown .total-row {
  border-top: none;
  margin-top: 0;
  padding-top: .25rem;
  font-size: .9rem;
}
#tax-breakdown .total-row:first-child {
  border-top: 1px solid var(--border);
  margin-top: .5rem;
  padding-top: .6rem;
}

.total-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .75rem;
  padding: .75rem 0 0;
  border-top: 1px solid var(--border);
  margin-top: .5rem;
  font-weight: 700;
  font-size: 1.05rem;
}

.total-label { color: var(--text-muted); font-weight: 500; font-size: .9rem; }

.form-actions {
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ── Public quote page ────────────────────────────── */
.public-wrap {
  min-height: 100vh;
  background: var(--bg);
  padding: 1.5rem 1rem 4rem;
}

.public-card { max-width: 520px; margin: 0 auto; }

.public-header {
  text-align: center;
  padding: 1rem 1.5rem .75rem;
  border-bottom: 1px solid var(--border);
}

.public-business { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: .15rem; }
.public-from { font-size: .75rem; font-weight: 400; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-right: .2rem; }
.public-customer { font-size: .95rem; margin-top: .35rem; color: var(--text); font-weight: 500; }
.public-logo-wrap { margin-bottom: .4rem; }
.public-logo { max-height: 60px; max-width: 180px; object-fit: contain; border-radius: 4px; }
.public-address { font-size: .8rem; color: var(--text-muted); line-height: 1.4; margin-top: .1rem; }
.public-address-required { color: var(--danger, #dc2626); font-weight: 700; margin-left: .15rem; }
.public-meta-row { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-top: .4rem; }
.quote-meta-date { font-size: .8rem; color: var(--text-muted); }

.public-items { padding: .75rem 1.25rem; }

.public-item-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: .35rem 0;
  border-bottom: 1px solid var(--border);
  gap: .75rem;
}

.public-item-row:last-child { border-bottom: none; }

.item-desc { flex: 1; font-size: .875rem; }
.item-price { font-size: .875rem; font-weight: 600; white-space: nowrap; }

.public-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .65rem 1.25rem;
  border-top: 2px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 1.1rem;
  font-weight: 700;
}

.public-notes {
  padding: 1rem 1.5rem;
  font-size: .9rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  line-height: 1.6;
}

.public-notes-label { font-weight: 600; color: var(--text); display: block; margin-bottom: .25rem; }

.public-address-block {
  padding: 1rem 1.5rem .25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.public-address-title {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text);
}

.public-address-optional {
  font-weight: 400;
  color: var(--text-muted);
}

.public-address-field {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.public-address-label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text);
}

.public-address-note {
  font-weight: 400;
  color: var(--text-muted);
  font-size: .7rem;
}

/* City / State / ZIP row */
.public-address-row {
  display: flex;
  gap: .5rem;
  align-items: flex-start;
}

.public-address-city  { flex: 1 1 0; }
.public-address-state { flex: 0 0 3.5rem; }
.public-address-zip   { flex: 0 0 5rem; }

.public-address-input {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  font-size: .9375rem;
  color: var(--text);
  background: var(--bg);
  box-sizing: border-box;
}

.public-address-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.public-actions {
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .75rem;
}

.public-status-banner {
  padding: 1.5rem;
  text-align: center;
  border-top: 1px solid var(--border);
}

.status-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.status-message { font-size: 1.05rem; font-weight: 600; margin-bottom: .25rem; }
.status-sub { font-size: .875rem; color: var(--text-muted); }

/* ── Alerts ───────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: 8px;
  font-size: .875rem;
  margin-bottom: 1rem;
}

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }

/* ── Profile ──────────────────────────────────────── */
.profile-card { padding: 1.5rem; }
.profile-hint { font-size: .8125rem; color: var(--text-muted); margin-top: .35rem; }

.notif-status-row {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.notif-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--border);
}

.notif-dot-green  { background: #22c55e; }
.notif-dot-yellow { background: #f59e0b; }
.notif-dot-red    { background: #ef4444; }
.notif-dot-grey   { background: #94a3b8; }

.notif-status-text { font-size: .9rem; font-weight: 500; color: var(--text); }

.profile-checkbox-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9375rem;
  cursor: pointer;
}

.profile-checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--brand);
}

/* ── Powered by footer ────────────────────────────── */
.powered-by {
  text-align: center;
  margin-top: 2rem;
  font-size: .75rem;
  color: var(--text-muted);
}

.powered-by a { color: var(--brand); text-decoration: none; }

/* ── Copy link btn ────────────────────────────────── */
.copy-btn {
  background: var(--brand-light);
  color: var(--brand);
  border: 1px solid #bfdbfe;
  padding: .3rem .6rem;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.copy-btn:hover { background: #dbeafe; }
.copy-btn.copied { background: var(--success-bg); color: var(--success); border-color: #bbf7d0; }

/* ── SMS button ───────────────────────────────────── */
.sms-btn {
  color: var(--brand);
  font-size: .75rem;
}

/* ── Share row — compact to fit on narrow phones ─── */
.quote-share-row .btn,
.quote-share-row .copy-btn {
  font-size: .7rem;
  padding: .25rem .45rem;
}

.sms-inline-btn {
  display: inline-block;
  background: var(--brand-light);
  color: var(--brand);
  border: 1px solid #bfdbfe;
  padding: .15rem .5rem;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 500;
  text-decoration: none;
  margin-left: .25rem;
  white-space: nowrap;
}

.maps-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}

.maps-link:hover {
  text-decoration: underline;
}

.maps-link-btn {
  display: inline-block;
  margin-top: .35rem;
  padding: .25rem .65rem;
  background: var(--brand);
  color: #fff;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.maps-link-btn:hover {
  background: #1d4ed8;
}

/* ── Saved address (approved public screen) ──────── */
.public-saved-address {
  padding: .875rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-alt, #f8fafc);
}

.public-saved-address-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: .2rem;
}

.public-saved-address-value {
  font-size: .9375rem;
  color: var(--text);
}

/* ── Payment section (public approved screen) ─────── */
.payment-section {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}

.payment-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .25rem;
}

.payment-section-sub {
  font-size: .8125rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.payment-buttons {
  display: flex;
  flex-direction: column;
  gap: .625rem;
}

.payment-btn {
  display: inline-flex;
  align-items: center;
  gap: .625rem;
  padding: .65rem .9rem;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: default;
  white-space: nowrap;
}

a.payment-btn, button.payment-btn { cursor: pointer; }

.payment-btn-stripe {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

a.payment-btn-stripe:hover { background: #e2e8f0; }

.payment-btn-venmo {
  background: #e8f4fd;
  color: #008cff;
  border-color: #b3d9f5;
}

a.payment-btn-venmo:hover { background: #d0eafc; }

.payment-btn-cashapp {
  background: #e8fdf0;
  color: #00c244;
  border-color: #a3f0bf;
}

a.payment-btn-cashapp:hover { background: #d0f7e3; }

.payment-btn-zelle {
  background: #f3e8fd;
  color: #6b21a8;
  border-color: #d4a6f7;
  align-self: flex-start;
}

.zelle-copied {
  display: inline-block;
  font-size: .75rem;
  color: #111;
  align-self: center;
}

/* ── Payment method row ───────────────────────────── */
.payment-method-row {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.payment-method-row .payment-btn {
  width: 100%;
  justify-content: center;
}

/* ── Locked payment buttons ───────────────────────── */
.payment-buttons-locked .payment-btn {
  opacity: .38;
  pointer-events: none;
  cursor: default;
}

.payment-hint {
  font-size: .8125rem;
  color: var(--text-muted);
  margin: 0 0 .75rem;
  text-align: center;
}

/* ── Tip selector ─────────────────────────────────── */
.tip-selector {
  margin: .75rem 0 .5rem;
}

.tip-selector-label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: .625rem;
}

.tip-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-bottom: .75rem;
}

.tip-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: .625rem .25rem;
  border-radius: 10px;
  border: 1.5px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  transition: border-color .12s, background .12s, box-shadow .12s;
  gap: .2rem;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}

.tip-option:hover {
  border-color: #1d4ed8;
  background: #eff6ff;
}

.tip-option.selected {
  border-color: #1e3a8a;
  background: #dbeafe;
  box-shadow: 0 0 0 3px rgba(30,58,138,.15);
}

.tip-pct {
  font-size: .9375rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

.tip-option.selected .tip-pct {
  color: #1e3a8a;
}

/* ── Custom tip row ───────────────────────────────── */
.tip-custom-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.tip-custom-input-wrap {
  display: flex;
  align-items: center;
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  padding: 0 .5rem;
}

.tip-custom-input-wrap:focus-within {
  border-color: #1d4ed8;
}

.tip-custom-prefix {
  color: var(--text-muted);
  font-size: .875rem;
  margin-right: .25rem;
  user-select: none;
}

#tip-custom {
  border: none;
  background: transparent;
  font-size: .875rem;
  color: var(--text);
  padding: .45rem 0;
  width: 100%;
  outline: none;
}

#tip-custom::-webkit-inner-spin-button,
#tip-custom::-webkit-outer-spin-button { -webkit-appearance: none; }


/* ── Grand total with tip ─────────────────────────── */
.tip-grand-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem .75rem;
  margin: .25rem 0 .75rem;
  border-radius: 8px;
  background: #dbeafe;
  font-weight: 700;
  font-size: 1rem;
  color: #1e3a8a;
}

/* ── Zelle send note ──────────────────────────────── */
.zelle-amount-note {
  font-size: .78rem;
  color: var(--text-muted);
  margin: 0;
  padding-left: .25rem;
}

/* ── Payment tags in quote detail ─────────────────── */
.detail-payment-tag {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .3rem .75rem;
  font-size: .875rem;
  color: var(--text);
}

/* ── Quote detail ─────────────────────────────────── */
.detail-card { padding: 1.25rem 1.5rem; }

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: .45rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.detail-label { font-size: .8125rem; color: var(--text-muted); flex-shrink: 0; }
.detail-value { font-size: .9375rem; color: var(--text); text-align: right; }

.detail-item-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  gap: .75rem;
}

.detail-item-row:last-of-type { border-bottom: none; }
.detail-item-desc { font-size: .9375rem; flex: 1; }
.detail-item-price { font-size: .9375rem; font-weight: 600; white-space: nowrap; }

.detail-total-row {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1.05rem;
  padding-top: .75rem;
  margin-top: .25rem;
  border-top: 2px solid var(--border);
}

/* ── Catalog / My Services ────────────────────────── */
.catalog-hint {
  font-size: .875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.catalog-group { padding: 1.25rem; margin-bottom: .75rem; }

.catalog-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
  gap: .75rem;
}

.catalog-item-row:last-child { border-bottom: none; }

.catalog-item-info { display: flex; flex-direction: column; gap: .15rem; flex: 1; min-width: 0; }
.catalog-item-desc { font-size: .9375rem; font-weight: 500; }
.catalog-item-price { font-size: .8125rem; color: var(--text-muted); }
.price-unset { font-style: italic; }

.catalog-item-actions { display: flex; gap: .25rem; flex-shrink: 0; }

/* ── Inline edit form ─────────────────────────────── */
.catalog-edit-form { width: 100%; padding: .5rem 0; }
.inline-edit-fields {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}
.inline-edit-desc {
  flex: 1;
  min-width: 180px;
  padding: .45rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
}
.inline-edit-price {
  width: 110px;
  padding: .45rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
}
.inline-edit-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.inline-edit-msg { font-size: .8125rem; margin-left: .25rem; }

/* ── Line item description wrapper ────────────────── */
.li-desc-wrap { min-width: 0; position: relative; }
.li-desc-input { width: 100%; }

/* ── Autocomplete dropdown ────────────────────────── */
.ac-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  z-index: 100;
  max-height: 220px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: .25rem 0;
}

.ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .75rem;
  font-size: .9rem;
  cursor: pointer;
  color: var(--text);
  gap: .5rem;
}

.ac-item:hover,
.ac-item.active { background: var(--brand-light); color: var(--brand); }

.ac-price {
  font-size: .8rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Add service category card ───────────────────── */
.add-cat-card { padding: .85rem 1.25rem; }
.add-cat-form { display: flex; gap: .6rem; align-items: center; }
.add-cat-form input[type="text"] {
  flex: 1;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
}

/* ── Bulk-delete toolbar ─────────────────────────── */
.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: #f0f4ff;
  border: 1px solid #c7d4f0;
  border-radius: var(--radius);
  padding: .55rem 1rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}
.bulk-count { font-size: .875rem; font-weight: 600; flex: 1; }
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { opacity: .88; }

/* ── Catalog group header ────────────────────────── */
.catalog-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .4rem;
}
.select-group-label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

/* ── Per-item checkbox ───────────────────────────── */
.catalog-item-row { align-items: flex-start; gap: .5rem; }
.item-check-wrap {
  display: flex;
  align-items: center;
  padding-top: .25rem;
  flex-shrink: 0;
}
.item-check-wrap input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* ── Service category management ─────────────────── */
.manage-cats-link {
  font-size: .75rem;
  font-weight: 500;
  color: var(--brand);
  text-decoration: none;
  margin-left: .5rem;
}
.manage-cats-link:hover { text-decoration: underline; }

.cat-manage-row {
  padding: .65rem 0;
  border-bottom: 1px solid var(--border);
}
.cat-manage-row:last-child { border-bottom: none; }

.cat-view {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.cat-info { display: flex; flex-direction: column; gap: .1rem; flex: 1; }
.cat-name { font-size: .9375rem; font-weight: 500; }
.cat-count { font-size: .8rem; color: var(--text-muted); }
.cat-actions { display: flex; gap: .25rem; flex-shrink: 0; }

.cat-edit-form { padding: .25rem 0; }
.cat-rename-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.cat-rename-input {
  flex: 1;
  min-width: 160px;
  padding: .45rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 480px) {
  .page-header { flex-direction: column; align-items: flex-start; }
  /* Two-row card layout for line items */
  .li-col-headers { display: none; }
  .line-item-row {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    border: 1.5px solid #bbb;
    border-radius: 8px;
    padding: .6rem .75rem;
    margin-bottom: .5rem;
    background: #fff;
  }
  /* Row 1: description full-width */
  .li-desc-wrap { width: 100%; }
  /* Row 2: controls as flex row */
  .li-controls-row {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: .5rem;
    border-top: 1px solid var(--border);
    padding-top: .45rem;
  }
  /* Qty wrapper: fixed narrow column; price wrapper: grows to fill remaining space */
  .item-ctrl-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 52px;
    flex-shrink: 0;
  }
  .item-ctrl-wrap.item-ctrl-price { flex: 1; width: auto; min-width: 0; }
  .item-ctrl-label { display: block; }
  /* inputs fill their wrapper — wrapper controls the actual rendered width */
  .item-ctrl-wrap input[type="number"] { width: 100%; }
  .item-taxable-wrap {
    flex-direction: column;
    align-items: center;
    width: auto;
    gap: 3px;
  }
  .remove-item-btn { align-self: flex-end; margin-bottom: 1px; }
  .public-actions { flex-direction: column; }
  .public-actions .btn { width: 100%; }
  .catalog-item-row { flex-direction: column; align-items: flex-start; }
  .catalog-item-actions { align-self: flex-end; }
}

@media (max-width: 360px) {
  .public-wrap { padding-left: .5rem; padding-right: .5rem; }
  .payment-section { padding-left: .875rem; padding-right: .875rem; }
  .payment-btn { padding: .55rem .7rem; font-size: .8375rem; }
  .tip-options { gap: .3rem; }
  .tip-option { padding: .5rem .15rem; }
  .tip-pct { font-size: .8rem; }
  .tip-dollar { font-size: .7rem; }
}

/* ── Internal Notes textarea ─────────────────────── */
.notes-textarea {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  resize: vertical;
  min-height: 80px;
  line-height: 1.55;
  transition: border-color .15s;
}
.notes-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* ── Photo grid ──────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: .6rem;
  margin-top: .25rem;
}
.photo-thumb {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--border);
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: .65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.photo-delete-btn:hover { background: rgba(220,38,38,.85); }

/* ── Customer list row ───────────────────────────── */
.customer-row {
  cursor: pointer;
  transition: box-shadow .15s;
}
.customer-row:hover { box-shadow: var(--shadow-md); }
