/* ROOTS CRM — brand: olive #3a3b36, gold #af8841 / #b89248, orange #f15622 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --olive: #3a3b36; --olive-d: #2e2f2b; --gold: #af8841; --gold-l: #b89248;
  --orange: #f15622; --paper: #f6f4ef; --card: #ffffff; --ink: #2a2b27;
  --line: #e3ddd2; --green: #3d7a44; --red: #c0392b; --muted: #7a776e;
}
body { font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; background: var(--paper); color: var(--ink); min-height: 100vh; }

/* Living background — soft brand-color blobs drifting behind everything */
body::before, body::after {
  content: ''; position: fixed; z-index: -1; border-radius: 50%; filter: blur(70px); opacity: .16; pointer-events: none;
}
body::before { width: 46vw; height: 46vw; background: radial-gradient(circle, var(--gold), transparent 70%); top: -12vw; right: -10vw; animation: drift1 26s ease-in-out infinite alternate; }
body::after { width: 40vw; height: 40vw; background: radial-gradient(circle, var(--orange), transparent 70%); bottom: -14vw; left: -12vw; animation: drift2 32s ease-in-out infinite alternate; }
@keyframes drift1 { from { transform: translate(0, 0) scale(1); } to { transform: translate(-9vw, 7vw) scale(1.15); } }
@keyframes drift2 { from { transform: translate(0, 0) scale(1); } to { transform: translate(10vw, -8vw) scale(1.1); } }

/* Cards slide up as each page renders */
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.card, .stat, .hero-greet { animation: riseIn .38s ease both; }
.card:nth-of-type(2) { animation-delay: .05s; } .card:nth-of-type(3) { animation-delay: .1s; }
.card:nth-of-type(4) { animation-delay: .15s; } .card:nth-of-type(5) { animation-delay: .2s; }
.card:nth-of-type(6) { animation-delay: .25s; } .card:nth-of-type(7) { animation-delay: .3s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 18px 0 12px; letter-spacing: .3px; }
h2 { font-size: 17px; margin-bottom: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--olive); }
h3 { font-size: 14px; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--red); margin-top: 8px; min-height: 18px; font-size: 13px; }

/* topbar */
.topbar { background: var(--olive); color: #fff; display: flex; align-items: center; gap: 18px; padding: 10px 18px; flex-wrap: wrap; position: sticky; top: 0; z-index: 50; }
.brand { display: flex; align-items: baseline; gap: 6px; }
.brand-mark { font-weight: 800; letter-spacing: 3px; font-size: 20px; color: var(--gold-l); }
.brand-sub { font-size: 11px; letter-spacing: 2px; color: #cfc9ba; }
.topbar nav { display: flex; gap: 2px; flex-wrap: nowrap; flex: 1; overflow-x: auto; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a { color: #d9d4c7; padding: 7px 9px; border-radius: 6px; font-size: 12.5px; white-space: nowrap; transition: background .15s, color .15s; }
.topbar nav a.on, .topbar nav a:hover { background: var(--olive-d); color: var(--gold-l); text-decoration: none; }
.who { font-size: 13px; color: #cfc9ba; }
.link { background: none; border: none; color: var(--gold-l); cursor: pointer; font-size: 13px; text-decoration: underline; }

.page { max-width: 1060px; margin: 0 auto; padding: 12px 18px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin: 14px 0; box-shadow: 0 1px 3px rgba(58,59,54,.06); }
.card-alert { border-left: 5px solid var(--orange); }
.alert-line { padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.alert-line:last-child { border-bottom: none; }

/* stats */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 14px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.stat-bad { border-color: var(--orange); background: #fff4ef; }
.stat-n { font-size: 24px; font-weight: 800; color: var(--olive); }
.stat-l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 3px; }
.money-grid, .hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 12px; }

/* progress */
.pbar { position: relative; background: #eae5da; border-radius: 20px; height: 18px; overflow: hidden; margin: 8px 0; }
.pbar-lg { height: 26px; }
.pbar-fill { background: linear-gradient(90deg, var(--gold), var(--orange)); height: 100%; border-radius: 20px; transition: width .4s; }
.pbar-money .pbar-fill { background: linear-gradient(90deg, #6a9c6f, var(--green)); }
.pbar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--olive); }

/* chips */
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; text-transform: uppercase; letter-spacing: .4px; vertical-align: middle; }
.chip-green { background: #e2efe3; color: var(--green); }
.chip-gold { background: #f5ead6; color: #8a6a2e; }
.chip-red { background: #fbe3de; color: var(--red); }
.chip-gray { background: #eceae4; color: var(--muted); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 8px 0; }
.tbl th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.tbl th, .tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.tbl tr.total td { font-weight: 800; border-top: 2px solid var(--olive); }
.tbl tr.grand td { color: var(--orange); font-size: 16px; }
.tbl tr.late td { background: #fbe3de; }
.tbl tr.soon td { background: #f5ead6; }
.mini { width: 80px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; }

/* job rows */
.jobrow { display: block; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; color: var(--ink); transition: border-color .15s; }
.jobrow:hover { border-color: var(--gold); text-decoration: none; }
.jobrow-main { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.jobrow-money { font-size: 12.5px; color: var(--muted); }

/* phase strip */
.phase-strip { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.phase-dot { flex: 1; min-width: 86px; text-align: center; font-size: 10.5px; padding: 7px 4px; border-radius: 8px; background: #eceae4; color: var(--muted); border: 1px solid var(--line); }
.phase-dot.done { background: #e2efe3; color: var(--green); border-color: #bcd8bf; }
.phase-dot.active { background: #f5ead6; color: #8a6a2e; border-color: var(--gold); font-weight: 700; }

/* checklists */
.phase-card.pending { opacity: .62; }
.phase-card.active { border-left: 5px solid var(--gold); }
.phase-card.done { border-left: 5px solid var(--green); }
.gate-line { background: var(--olive); color: #f0ead9; padding: 9px 12px; border-radius: 8px; font-size: 13px; margin: 8px 0 12px; }
.check-items { display: grid; gap: 4px; margin-bottom: 12px; }
.check-item { display: flex; gap: 9px; align-items: flex-start; padding: 7px 9px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.check-item:hover { background: var(--paper); }
.check-item.done span { text-decoration: line-through; color: var(--muted); }
.check-item input { width: auto; display: inline-block; margin-top: 3px; transform: scale(1.25); accent-color: var(--gold); }
.check-item span { flex: 1; text-align: left; }
.check-item.locked { cursor: not-allowed; }
.check-item em { font-size: 11.5px; font-style: normal; }
.signoff-done { background: #e2efe3; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-top: 10px; }

/* milestones */
.ms-list { display: grid; gap: 6px; margin: 10px 0; }
.ms { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; }
.ms-paid { background: #f2f8f2; }
.ms-due { background: #fbe3de; border-color: var(--red); }
.ms-approaching { background: #f5ead6; }

/* change orders */
.co-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin: 6px 0; font-size: 14px; }
.co-approved { background: #f2f8f2; }
.co-submitted { background: #f5ead6; }
.co-draft { background: #fbe3de; }

/* buttons & forms */
.btn { background: #fff; border: 1.5px solid var(--olive); color: var(--olive); border-radius: 8px; padding: 9px 16px; font-size: 14px; font-weight: 700; cursor: pointer; }
.btn:hover { background: var(--paper); }
.btn-primary { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-primary:hover { background: #9a7736; }
.btn-danger { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-block { display: block; width: 100%; margin: 8px 0; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-job { text-align: left; }
label { display: block; font-size: 13px; font-weight: 600; margin: 8px 0; color: var(--olive); }
label input, label select, label textarea { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; }
.chk { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.chk input { width: auto; margin-top: 2px; transform: scale(1.2); accent-color: var(--gold); }
.chk.big { font-size: 15px; padding: 8px; background: var(--paper); border-radius: 8px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.inline-form input { flex: 1; min-width: 140px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; }

/* tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 14px 0 4px; }
.tab { background: #eceae4; border: none; padding: 9px 15px; border-radius: 8px 8px 0 0; font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.tab.on { background: var(--olive); color: var(--gold-l); }

/* quote */
.quote-grid { display: grid; grid-template-columns: 400px 1fr; gap: 14px; align-items: start; }
@media (max-width: 860px) { .quote-grid { grid-template-columns: 1fr; } }
.qsec { background: var(--olive); color: var(--gold-l); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; padding: 7px 12px; border-radius: 8px; margin: 16px 0 6px; }
.qsec .muted { color: #cfc9ba; text-transform: none; letter-spacing: 0; font-weight: 500; }
.qrow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qsec-row td { background: var(--paper); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--olive); }
.qsec-days { float: right; color: var(--orange); font-size: 12px; }
.qsec-gate { font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 12px; color: #f0ead9; background: var(--olive); border-radius: 6px; padding: 5px 9px; margin-top: 5px; }
.qrule { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.qgoal { white-space: nowrap; font-weight: 700; color: var(--olive); }
.tbl-goal th:nth-child(2), .tbl-goal td.qgoal { text-align: center; }
.tbl-goal td:last-child, .tbl-goal th:last-child { text-align: right; }
.tbl-goal .qsec-row td { text-align: left; }

/* messages */
.banner-sim { background: #f5ead6; border: 1px solid var(--gold); border-radius: 8px; padding: 10px 14px; font-size: 13px; }
.msg-head { font-size: 12.5px; margin-bottom: 4px; }
.msg-subject { font-weight: 700; margin-bottom: 4px; }
.msg-body { font-size: 13.5px; }
.log-line { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.doc-line { padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(42,43,39,.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 14px; padding: 22px; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.warn-box { background: #fbe3de; border: 1px solid var(--red); border-radius: 8px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 10px; }
.warn-box ul { margin: 6px 0 6px 18px; }

/* clock */
.clock-card { text-align: center; }
.clock-card.on-clock { border: 2px solid var(--green); background: #f2f8f2; }

/* login */
.login-bg { background: var(--olive); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--paper); border-radius: 16px; padding: 34px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-logo { font-size: 34px; font-weight: 800; letter-spacing: 8px; color: var(--gold); text-align: center; }
.login-tag { text-align: center; font-size: 11px; letter-spacing: 1px; color: var(--muted); margin: 4px 0 18px; text-transform: uppercase; }
.login-card h1 { text-align: center; font-size: 18px; margin-bottom: 14px; }
.demo-creds { margin-top: 18px; background: #fff; border: 1px dashed var(--line); border-radius: 10px; padding: 12px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.dc-title { font-weight: 700; color: var(--olive); }
.back { display: inline-block; margin-top: 10px; font-size: 13px; }
.hero-card { border-top: 5px solid var(--gold); }

/* hero + section subtitles */
.hero-greet { margin: 18px 0 6px; }
.hero-greet h1 { margin: 0 0 2px; }
.sub { color: var(--muted); font-size: 13px; margin: -4px 0 10px; }
.done-note { background: #e2efe3; border-radius: 10px; padding: 12px 14px; margin-top: 12px; font-size: 15px; }
.portal-foot { text-align: center; color: var(--muted); font-size: 12px; letter-spacing: .5px; margin: 26px 0 10px; }
.pos { color: var(--green); font-weight: 700; } .neg { color: var(--red); font-weight: 700; }

/* leaderboard */
.lb-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.lb-row:last-child { border-bottom: none; }
.lb-medal { font-size: 22px; width: 32px; text-align: center; flex-shrink: 0; }
.lb-main { flex: 1; min-width: 0; }
.lb-name { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.lb-pts { margin-left: auto; font-weight: 800; color: var(--orange); font-size: 14px; }
.lb-bar { background: #eae5da; border-radius: 20px; height: 8px; margin: 5px 0 4px; overflow: hidden; }
.lb-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--gold), var(--orange)); animation: growBar 1s ease both; }
@keyframes growBar { from { width: 0; } }
.lb-stats { font-size: 12px; color: var(--muted); }

/* live pulse dot for who's on the clock */
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-left: 5px; animation: pulse 1.6s ease-in-out infinite; vertical-align: middle; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.75); } }

/* progress bars fill on load */
.pbar-fill { animation: growBar 1s ease both; }

/* confetti */
.confetti-box { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.confetti-bit { position: absolute; top: -14px; width: 9px; height: 14px; border-radius: 2px; animation: confallDown linear both; }
@keyframes confallDown { to { transform: translateY(105vh) rotate(560deg); opacity: .7; } }

/* ---- Change-order spotlight ---- */
.co-spotlight { border: 3px solid var(--orange); background: #fff8f4; }
.co-delta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 10px 0 14px; }
.co-arrow { font-size: 22px; color: var(--orange); font-weight: 800; }
.co-big { display: flex; gap: 14px; align-items: stretch; border-radius: 12px; margin: 8px 0; overflow: hidden; border: 1.5px solid var(--line); background: #fff; }
.co-stamp { min-width: 110px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 900; font-size: 14px; letter-spacing: .5px; text-align: center; padding: 10px; transform: rotate(-2deg); }
.co-stamp small { font-weight: 600; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; }
.co-big-approved .co-stamp { background: #e2efe3; color: var(--green); border-right: 3px dashed var(--green); }
.co-big-denied .co-stamp { background: #fbe3de; color: var(--red); border-right: 3px dashed var(--red); }
.co-big-submitted .co-stamp { background: #f5ead6; color: #8a6a2e; border-right: 3px dashed var(--gold); }
.co-big-draft .co-stamp { background: #eceae4; color: var(--muted); border-right: 3px dashed var(--muted); }
.co-big-body { padding: 10px 12px; font-size: 14px; flex: 1; }
.co-requester { display: inline-block; background: var(--olive); color: #f0ead9; font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; border-radius: 5px; padding: 3px 8px; margin-bottom: 5px; }

/* ---- Universal search ---- */
.gsearch { position: relative; min-width: 170px; }
.gsearch input { width: 100%; padding: 7px 11px; border-radius: 20px; border: 1px solid #55564f; background: var(--olive-d); color: #eee8d8; font-size: 12.5px; }
.gsearch input::placeholder { color: #9a968a; }
#gsearch-results { display: none; position: absolute; top: 38px; right: 0; width: 340px; max-height: 60vh; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgba(42,43,39,.25); z-index: 250; }
#gsearch-results a { display: block; padding: 9px 13px; border-bottom: 1px solid var(--paper); color: var(--ink); font-size: 13px; }
#gsearch-results a:hover { background: var(--paper); text-decoration: none; }
.gs-kind { display: inline-block; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--gold); background: var(--paper); border-radius: 10px; padding: 1px 7px; margin-right: 4px; }

/* ---- Job allocation / switch ---- */
.alloc-grid { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 8px 0; }

/* ---- Sign-off "this will" box ---- */
.will-box { background: var(--paper); border-radius: 10px; padding: 10px 14px; font-size: 13px; margin: 10px 0; }
.will-box ul { margin: 6px 0 0 18px; display: grid; gap: 3px; }

/* ---- Customers page ---- */
.cust-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 8px; }

/* ---- Portal action required ---- */
.action-required { border: 3px solid var(--red); background: #fff7f5; }
.action-required h2 { color: var(--red); }

/* ---- Legal terms ---- */
.legal-doc { font-size: 12.5px; line-height: 1.55; color: var(--ink); }
.legal-doc p { margin: 7px 0; }
.legal-title { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--olive); margin: 12px 0 4px; border-bottom: 2px solid var(--gold); padding-bottom: 4px; }
.legal-intro { color: var(--muted); font-style: italic; }
details { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 8px 0; background: #fff; }
details summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--olive); }
details[open] summary { margin-bottom: 6px; }
.modal-wide { max-width: 680px; }
.cof-ack { display: grid; gap: 8px; background: var(--paper); border-radius: 10px; padding: 12px; margin: 10px 0; font-size: 13px; }
.cof-ack .chk { display: block; line-height: 1.5; }
.cof-ack .chk input { display: inline-block; width: auto; margin-right: 8px; vertical-align: -2px; }
@media print { details { border: none; padding: 0; } }

/* ---- Job diary ---- */
.diary-line { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.diary-date { flex-shrink: 0; width: 90px; color: var(--muted); font-size: 12px; padding-top: 2px; }

/* ---- Pending text approval queue ---- */
.pending-text { border: 1.5px dashed var(--gold); border-radius: 10px; padding: 12px; margin: 10px 0; background: #fffdf8; }
.pending-text textarea { width: 100%; margin: 8px 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; font-family: inherit; }

/* ---- Admin impersonation bar ---- */
/* One slot holds every session bar. Sticky lives here, not on each bar,
   so two bars cannot each claim the top of the page. */
#session-bars { position: sticky; top: 0; z-index: 200; }
#session-bars:empty { display: none; }
.impersonate-bar { background: var(--orange); color: #fff; padding: 8px 16px; font-size: 13.5px; display: flex; gap: 6px 12px; align-items: center; flex-wrap: wrap; line-height: 1.45; }
.impersonate-bar + .impersonate-bar { border-top: 1px solid rgba(255,255,255,.35); }
.impersonate-bar .btn { background: #fff; color: var(--orange); border-color: #fff; margin-left: auto; white-space: nowrap; }
@media (max-width: 760px) { .impersonate-bar .btn { margin-left: 0; } }

/* A row of buttons or chips that WRAPS. Inline-block buttons separated by
   a space have no row gap, so the second line sat on top of the first. */
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* The "present as Gold / Silver / Bronze" tick: its own line under the
   quote builder's header, never wrapped into the button row. */
.qb-present { display: flex; align-items: center; gap: 10px; margin: 2px 0 14px; font-size: 14px; cursor: pointer; }
.qb-present input { margin: 0; width: 18px; height: 18px; flex: 0 0 auto; }
/* Buttons stacked in a table's action cell. */
.cell-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.cell-acts .btn { white-space: nowrap; }

/* THE SAME OVERLAP, EVERYWHERE ELSE.

   Two inline-block buttons separated by a newline in the template get a
   space between them and NO row gap, so the moment the column is narrow
   enough to wrap, the second button draws on top of the first. This is a
   whole class of bug rather than one page, so it is fixed once here for
   every table action cell and every alert row that carries controls. */
.tbl td > .btn + .btn,
.tbl td > .btn + a.btn,
.tbl td > a.btn + .btn,
.tbl td > a.btn + a.btn { margin: 3px 0 0 6px; }
.alert-line .btn + .btn, .warn-box .btn + .btn { margin: 3px 0 0 6px; }
/* A wrapping row of chips needs the same treatment. */
.warn-box .chip, .alert-line .chip { margin-bottom: 2px; }

/* ---- Sell Mode ---- */
.sell-hero { background: var(--olive); color: #eee8d8; border: none; }
.sell-hero .stat { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.14); }
.sell-hero .stat-n { color: var(--gold-l); }
.sell-hero .stat-l { color: #cfc9ba; }
.sell-mark { font-size: 30px; font-weight: 800; letter-spacing: 7px; color: var(--gold-l); }
.sell-tag { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: #b6b0a0; margin-bottom: 12px; }
.sell-lede { font-size: 16.5px; line-height: 1.55; max-width: 640px; margin: 8px 0 14px; }
.five-moves { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.move { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 4px; font-size: 13px; }
.move-n { width: 28px; height: 28px; border-radius: 50%; background: var(--gold); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.move span { color: var(--muted); }
.sell-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; font-size: 14px; line-height: 1.5; }
.quote-wall { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.tquote { background: var(--paper); border-left: 4px solid var(--gold); border-radius: 8px; padding: 12px; font-size: 14px; font-style: italic; }
.tquote span { display: block; font-style: normal; color: var(--muted); font-size: 12px; margin-top: 6px; }
.sell-cta { border: 2px solid var(--gold); }
.cta-row { display: grid; gap: 8px; margin: 8px 0; }

/* ---- Proposal ---- */
.prop-sheet { padding: 30px; }
.prop-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 3px solid var(--gold); padding-bottom: 14px; margin-bottom: 16px; }
.prop-meta { text-align: right; font-size: 13px; color: var(--muted); }
.prop-title { font-size: 24px; margin: 6px 0; }
.prop-lede { color: var(--muted); max-width: 620px; margin-bottom: 14px; }
.prop-steps { margin: 8px 0 8px 20px; display: grid; gap: 7px; font-size: 14px; }
.prop-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 34px; font-size: 12.5px; color: var(--muted); }
.sig-line { border-bottom: 1.5px solid var(--ink); height: 34px; margin-bottom: 6px; }
@media print {
  .topbar, .no-print, body::before, body::after { display: none !important; }
  body { background: #fff; }
  .page { max-width: none; padding: 0; }
  .card { box-shadow: none; border: none; margin: 0; animation: none; }
  .prop-sheet { padding: 0; }
}

@media (max-width: 640px) {
  h1 { font-size: 21px; }
  .co-line { flex-direction: column; align-items: flex-start; }
  .prop-sign { grid-template-columns: 1fr; gap: 24px; }
}

/* ===================== SCHEDULING ===================== */
.sched-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 12px 0 6px; }
.sched-views { display: flex; gap: 4px; }
.sched-nav { display: flex; gap: 6px; align-items: center; }
.sched-range { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 6px; }
.sched-actions { margin-left: auto; display: flex; gap: 6px; }
.sched-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.fsel { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; margin: 0; }
.fsel select { display: block; margin-top: 3px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; }

/* chips */
.sched-chip { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 8px;
  padding: 7px 9px; margin-bottom: 5px; cursor: pointer; font-size: 12.5px; transition: box-shadow .12s, transform .12s; }
.sched-chip:hover { box-shadow: 0 2px 8px rgba(58,59,54,.14); transform: translateY(-1px); }
.sched-chip.is-overdue { background: #fbe3de; }
.chip-top { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.chip-status { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); white-space: nowrap; }
.chip-sub { color: var(--muted); font-size: 11.5px; }
.chip-meta { color: var(--muted); font-size: 11px; }
.chip-cf { font-size: 10.5px; margin-top: 3px; font-weight: 700; }
.cf-wait { color: #8a6a2e; } .cf-ok { color: var(--green); } .cf-no { color: var(--red); }
.cf-line { padding: 7px 10px; border-radius: 8px; background: var(--paper); font-size: 13px; margin: 8px 0; font-weight: 600; }
.ss-done { opacity: .72; } .ss-none { border-left-color: var(--red) !important; }
.ss-prog { background: #fffaf0; } .ss-hold { opacity: .6; }

/* week + month grids */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-col { background: var(--paper); border-radius: 10px; padding: 6px; min-height: 130px; border: 1px solid transparent; }
.week-col.is-today { border-color: var(--gold); background: #fffdf6; }
.week-col.is-weekend { opacity: .65; }
.week-col.drop-hot { border-color: var(--orange); background: #fff4ef; }
.week-head { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
  display: flex; justify-content: space-between; margin-bottom: 5px; }
.week-head span { color: var(--olive); }
.week-empty { color: #cfc9ba; text-align: center; font-size: 12px; padding: 6px 0; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.month-head { font-size: 10.5px; font-weight: 800; text-transform: uppercase; color: var(--muted); text-align: center; padding: 4px 0; }
.month-cell { background: var(--paper); border-radius: 7px; min-height: 84px; padding: 4px; border: 1px solid transparent; }
.month-cell.is-off { opacity: .4; }
.month-cell.is-today { border-color: var(--gold); background: #fffdf6; }
.month-cell.drop-hot { border-color: var(--orange); }
.month-date { font-size: 11px; color: var(--muted); font-weight: 700; }
.month-item { color: #fff; font-size: 10.5px; border-radius: 4px; padding: 2px 5px; margin-top: 2px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month-more { font-size: 10px; color: var(--muted); margin-top: 2px; }
.day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }

/* timeline rows */
.tl-rows { display: grid; gap: 2px; }
.tl-row { display: grid; grid-template-columns: 1.6fr 1.2fr 1fr auto; gap: 10px; align-items: center;
  padding: 9px 10px; border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.tl-row:hover { background: var(--paper); }
.tl-row.is-overdue { background: #fbe3de; }
.tl-row.is-new { background: #f5ead6; }
.tl-name { font-weight: 600; }
.tl-when, .tl-who { color: var(--muted); font-size: 12.5px; }
.proj-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* people grid */
.people-grid { display: grid; gap: 3px; overflow-x: auto; }
.ph { font-size: 10.5px; font-weight: 800; text-transform: uppercase; color: var(--muted); text-align: center; padding: 4px 0; }
.pname { font-size: 12.5px; font-weight: 700; padding: 6px 4px; }
.pcell { background: var(--paper); border-radius: 6px; min-height: 40px; padding: 3px; }
.pcell.is-conflict { background: #fbe3de; outline: 1px solid var(--red); }
.pchip { color: #fff; font-size: 10px; border-radius: 4px; padding: 2px 4px; margin-bottom: 2px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pfree { font-size: 10.5px; color: #c9c3b6; }

/* health card */
.sched-health.good { border-left: 5px solid var(--green); }
.sched-health.warn { border-left: 5px solid var(--gold); }
.sched-health.bad { border-left: 5px solid var(--orange); }

/* build wizard */
.bs-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px; margin: 8px 0; }
.bs-row { display: grid; grid-template-columns: 1fr 74px 88px 150px; gap: 6px; align-items: center;
  padding: 5px 6px; border-bottom: 1px dashed var(--line); }
.bs-row:last-child { border-bottom: none; }
.bs-row .chk { margin: 0; font-weight: 500; }
.bs-row select.mini { width: 100%; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }

/* customer timeline */
.ct-row { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.ct-row:last-child { border-bottom: none; }
.ct-mark { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; flex-shrink: 0; background: #eceae4; color: var(--muted); }
.ct-row.done .ct-mark { background: #e2efe3; color: var(--green); }
.ct-row.now .ct-mark { background: var(--gold); color: #fff; }

/* field today cards */
.today-card { border: 1.5px solid var(--gold); border-radius: 12px; padding: 12px; margin: 8px 0; background: #fffdf6; }
.today-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.today-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.today-btns .btn { flex: 1; min-width: 104px; text-align: center; }

@media (max-width: 820px) {
  .week-grid { grid-template-columns: 1fr; }
  .week-col { min-height: auto; }
  .month-cell { min-height: 62px; }
  .tl-row { grid-template-columns: 1fr; gap: 3px; }
  .bs-row { grid-template-columns: 1fr 1fr; }
  .sched-actions { margin-left: 0; }
}

/* ---- click-to-schedule rows ---- */
.qs-head { display: grid; grid-template-columns: 34px 1fr 190px 130px 92px 32px; gap: 8px;
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); padding: 0 6px 6px; }
.qs-row { display: grid; grid-template-columns: 34px 1fr 190px 130px 92px 32px; gap: 8px; align-items: center;
  padding: 8px 6px; border-bottom: 1px solid var(--line); position: relative; }
.qs-row:last-of-type { border-bottom: none; }
.qs-row.is-overdue { background: #fbe3de; border-radius: 8px; }
.qs-check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); background: #fff;
  cursor: pointer; font-size: 14px; font-weight: 900; color: #fff; line-height: 1; transition: all .15s; }
.qs-check:hover { border-color: var(--green); background: #e2efe3; }
.qs-check.on { background: var(--green); border-color: var(--green); }
.qs-name { font-size: 14px; font-weight: 600; }
.qs-date { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px;
  font-size: 12.5px; font-weight: 600; color: var(--olive); cursor: pointer; text-align: left; width: 100%; }
.qs-date:hover { border-color: var(--gold); background: #fffdf6; }
.qs-date.is-empty { color: var(--red); border-style: dashed; border-color: var(--red); background: #fff; }
.qs-who { padding: 6px 7px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; width: 100%; background: #fff; }
.qs-share { background: none; border: 1px dashed transparent; border-radius: 7px; padding: 4px 6px; cursor: pointer;
  font-size: 12px; font-weight: 700; color: var(--olive); text-align: center; line-height: 1.25; }
.qs-share span { display: block; font-size: 10px; font-weight: 600; color: var(--muted); }
.qs-share:hover { border-color: var(--gold); background: #fffdf6; }
.qs-more { background: none; border: none; color: var(--muted); font-size: 17px; cursor: pointer; padding: 2px; }
.qs-more:hover { color: var(--olive); }

/* done = greyed but fully readable */
.qs-row.is-done { background: #f7faf7; border-radius: 8px; }
.qs-row.is-done .qs-name { color: #8d938c; font-weight: 500; }
.qs-row.is-done .qs-date, .qs-row.is-done .qs-who, .qs-row.is-done .qs-share { opacity: .55; }

/* inline day picker */
.qs-picker { grid-column: 1 / -1; }
.dp { background: var(--paper); border: 1px solid var(--gold); border-radius: 10px; padding: 10px; margin: 6px 0 2px; }
.dp-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.dp-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); gap: 5px; }
.dp-day { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 2px; cursor: pointer;
  display: grid; gap: 1px; text-align: center; transition: all .12s; }
.dp-day span { font-size: 10px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.dp-day b { font-size: 16px; color: var(--olive); }
.dp-day em { font-size: 9.5px; font-style: normal; color: var(--muted); }
.dp-day:hover { border-color: var(--gold); background: #fffdf6; transform: translateY(-1px); }
.dp-day.on { background: var(--gold); border-color: var(--gold); }
.dp-day.on span, .dp-day.on b, .dp-day.on em { color: #fff; }
.dp-foot { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.dp-foot label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; margin: 0; }
.dp-foot input { margin-top: 3px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }

/* dashboard mini week board */
.dash-week { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.dw-col { background: var(--paper); border-radius: 9px; padding: 6px; min-height: 92px; border: 1px solid transparent; }
.dw-col.is-today { border-color: var(--gold); background: #fffdf6; }
.dw-col.drop-hot { border-color: var(--orange); background: #fff4ef; }
.dw-head { font-size: 10.5px; font-weight: 800; text-transform: uppercase; color: var(--muted); margin-bottom: 4px;
  display: flex; justify-content: space-between; }
.dw-item { color: #fff; font-size: 10.5px; border-radius: 5px; padding: 3px 5px; margin-bottom: 3px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dw-item.done { opacity: .45; }

@media (max-width: 820px) {
  .qs-head { display: none; }
  .qs-row { grid-template-columns: 30px 1fr 30px; grid-template-areas: "c n m" ". d d" ". w w" ". s s"; gap: 5px; }
  .qs-check { grid-area: c; } .qs-name { grid-area: n; } .qs-more { grid-area: m; }
  .qs-date { grid-area: d; } .qs-who { grid-area: w; } .qs-share { grid-area: s; text-align: left; }
  .dash-week { grid-template-columns: 1fr; }
}

/* ---- expense coding inbox ---- */
.exp-card { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0; background: #fff; }
.exp-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.exp-amt { font-size: 20px; font-weight: 800; color: var(--olive); white-space: nowrap; }
.exp-jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 6px; }
.exp-job { background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--gold);
  border-radius: 9px; padding: 10px 9px; cursor: pointer; text-align: left; font-size: 13.5px; font-weight: 700;
  color: var(--olive); line-height: 1.3; transition: all .12s; }
.exp-job span { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.exp-job:hover { border-color: var(--gold); background: #fffdf6; transform: translateY(-1px); }
.exp-oh { border-left-color: var(--muted) !important; }
.sc-pick { background: var(--paper); border: 1px solid var(--gold); border-radius: 10px; padding: 10px; margin-top: 10px; }
.sc-lbl { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 7px; }
.sc-btn { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; margin: 0 5px 5px 0;
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--olive); }
.sc-btn:hover { border-color: var(--gold); background: #fffdf6; }
.sc-btn.on { border-color: var(--gold); background: #f5ead6; }
.sc-gen { border-style: dashed; color: var(--muted); }

/* ---- measurements grid ---- */
.meas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; margin: 10px 0 14px; }
.meas { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; margin: 0; }
.meas input { margin-top: 3px; width: 100%; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.tbl tr.is-off td { opacity: .42; }

@media (max-width: 820px) {
  .exp-jobs { grid-template-columns: 1fr 1fr; }
  .exp-amt { font-size: 18px; }
}

/* ===================== OWNER DASHBOARD ===================== */
.dash-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin: 18px 0 10px; }
.dash-top h1 { margin: 0; }
.dash-periods { display: flex; gap: 3px; background: var(--paper); padding: 3px; border-radius: 10px; }
.per { border: none; background: none; padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 700;
  color: var(--muted); cursor: pointer; transition: all .15s; }
.per.on { background: var(--olive); color: var(--gold-l); }
.per:hover:not(.on) { color: var(--olive); }

.hero-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 12px; }
.hero-kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
  border-top: 4px solid var(--gold); box-shadow: 0 1px 3px rgba(58,59,54,.06); }
.hk-rev { border-top-color: var(--gold); } .hk-cost { border-top-color: var(--muted); }
.hk-gp { border-top-color: var(--orange); } .hk-net { border-top-color: var(--green); }
.hk-neg { border-top-color: var(--red); background: #fff6f4; }
.hk-l { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.hk-n { font-size: 30px; font-weight: 800; color: var(--olive); line-height: 1.15; margin: 4px 0 2px; }
.hk-s { font-size: 11.5px; color: var(--muted); }

.ratio-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ratio-tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: help; }
.rt-l { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.rt-n { font-size: 22px; font-weight: 800; color: var(--olive); margin: 2px 0; }
.rt-s { font-size: 10.5px; color: var(--muted); }
.rt-good { border-left: 4px solid var(--green); } .rt-good .rt-n { color: var(--green); }
.rt-warn { border-left: 4px solid var(--gold); } .rt-warn .rt-n { color: #8a6a2e; }
.rt-bad  { border-left: 4px solid var(--red); }   .rt-bad .rt-n  { color: var(--red); }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 132px; padding: 8px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.bar-stack { flex: 1; display: flex; align-items: flex-end; gap: 2px; width: 100%; justify-content: center; }
.bar { width: 44%; border-radius: 3px 3px 0 0; min-height: 2px; transition: height .5s ease; }
.bar.rev { background: linear-gradient(180deg, var(--gold), #c79a4e); }
.bar.cst { background: #d8d2c6; }
.bar-lbl { font-size: 9.5px; color: var(--muted); }
.bar-key { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.bar-key .k { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-left: 10px; }
.bar-key .k.rev { background: var(--gold); } .bar-key .k.cst { background: #d8d2c6; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.oh-row { display: grid; grid-template-columns: 1.4fr 2fr auto; gap: 10px; align-items: center; padding: 6px 0;
  font-size: 13px; border-bottom: 1px dashed var(--line); }
.oh-bar { background: #eae5da; border-radius: 20px; height: 9px; overflow: hidden; }
.oh-bar div { background: linear-gradient(90deg, var(--gold), var(--orange)); height: 100%; border-radius: 20px; }

@media (max-width: 820px) {
  .two-col { grid-template-columns: 1fr; }
  .hk-n { font-size: 25px; }
  .bars { height: 100px; }
}
.cov-warn { background: #fffaf0; border: 1px solid var(--gold); border-left: 5px solid var(--gold);
  border-radius: 10px; padding: 11px 14px; font-size: 13px; margin-bottom: 12px; color: var(--ink); }
.rv-step { display: grid; grid-template-columns: 80px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.rv-step:last-child { border-bottom: none; }
.rv-when { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--gold); padding-top: 2px; }
.rv-body { background: var(--paper); border-radius: 9px; padding: 10px 12px; margin-top: 5px; font-size: 13px; line-height: 1.5; color: var(--ink); }

/* ---- bonus pool ---- */
.bonus-rules {
  margin: 14px 0 4px; padding: 13px 15px; border-radius: 10px;
  background: var(--paper); border-left: 3px solid var(--gold);
  font-size: 13px; line-height: 1.6; color: var(--ink);
}
.bonus-rules b { color: var(--olive); }
.tbl tr.row-muted td { opacity: .5; font-style: italic; }
.tbl tr.tot-row td {
  border-top: 2px solid var(--line); background: var(--paper);
}
.stat-s { font-size: 11px; color: var(--muted); margin-top: 2px; letter-spacing: .02em; }

/* ---- two bonus structures side by side ---- */
.bonus-2up { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 14px 0 4px; }
@media (max-width: 760px) { .bonus-2up { grid-template-columns: 1fr; } }
.bonus-struct { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.bonus-struct h3 { margin: 0 0 10px; color: var(--olive); font-size: 13px; }
.bonus-struct-n { display: flex; gap: 22px; margin-bottom: 8px; }
.tbl.tbl-tight td, .tbl.tbl-tight th { padding: 5px 7px; font-size: 12.5px; }
.tbl tr.row-parallel td:first-child { padding-left: 20px; }
.tbl tr.goal-ok td { background: rgba(61,122,68,.09); color: var(--green); font-weight: 700; }
.tbl tr.goal-over td { background: rgba(192,57,43,.09); color: var(--red); font-weight: 700; }

/* ---- jobber import flags ---- */
.jb-flag { border-left: 3px solid var(--line); background: var(--paper); border-radius: 9px;
  padding: 11px 14px; margin-bottom: 9px; }
.jb-flag.jb-high { border-left-color: var(--red); }
.jb-flag.jb-medium { border-left-color: var(--gold); }
.jb-flag-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.jb-flag-h b { color: var(--olive); font-size: 13.5px; }
.jb-amt { font-weight: 800; color: var(--red); white-space: nowrap; }
.jb-flag-d { font-size: 12.5px; line-height: 1.55; color: var(--ink); opacity: .85; }

/* ---- production locks ---- */
.chip-lock { background: rgba(61,122,68,.12); color: var(--green); border: 1px solid rgba(61,122,68,.3); }
.chip-open { background: rgba(175,136,65,.12); color: var(--gold); border: 1px solid rgba(175,136,65,.3); }
.dp-lock { flex: 1; min-width: 210px; background: var(--paper); border: 1px solid var(--line);
  border-left: 3px solid var(--green); border-radius: 9px; padding: 9px 12px; }
.dp-lock.is-over { border-left-color: var(--gold); }
.dp-lock.is-open { border-left-color: var(--muted); }
.dp-lock-n { font-weight: 800; color: var(--olive); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.lock-ico { font-size: 9.5px; letter-spacing: .08em; font-weight: 700; padding: 2px 6px; border-radius: 4px;
  background: rgba(61,122,68,.14); color: var(--green); }
.lock-ico.over { background: rgba(175,136,65,.16); color: var(--gold); }
.dp-lock-b { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.dp-lock-s { font-size: 12px; color: var(--ink); margin-top: 5px; font-weight: 600; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); margin-top: 7px; }

/* ---- phone: the top bar gets its own full-width nav row ----
   The crew lives on phones. At 375px the brand, search and name squeezed
   the nav strip down to ~10px, so the pages were technically scrollable and
   practically unreachable. Now nav takes its own row at full width. */
@media (max-width: 820px) {
  .topbar { gap: 8px 12px; padding: 9px 12px; row-gap: 8px; }
  .topbar .brand { order: 1; }
  .topbar .who { order: 2; margin-left: auto; font-size: 12px; }
  .topbar .gsearch { order: 4; flex-basis: 100%; }
  .topbar nav {
    order: 3; flex: 0 0 100%; width: 100%;
    margin: 0 -12px; padding: 2px 12px 4px;
    /* a fade on the right edge so it reads as swipeable */
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent 100%);
    mask-image: linear-gradient(to right, #000 88%, transparent 100%);
  }
  .topbar nav a { padding: 8px 11px; font-size: 13px; }
  .topbar nav a.on { background: var(--olive-d); color: var(--gold-l); }
}
/* When the strip is scrolled to the end, drop the fade */
@media (max-width: 820px) {
  .topbar nav.at-end { -webkit-mask-image: none; mask-image: none; }
}

/* ---- optional scope toggles ---- */
.opt-scopes { margin: 14px 0; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.opt-h { font-size: 12.5px; color: var(--muted); margin-bottom: 9px; }
.opt-chip { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 6px 13px;
  margin: 0 6px 6px 0; font-size: 12.5px; cursor: pointer; color: var(--ink); transition: all .15s; }
.opt-chip:hover { border-color: var(--gold); }
.opt-chip.on { background: var(--olive); color: #fff; border-color: var(--olive); }
.opt-chip span { opacity: .6; margin-left: 7px; font-size: 11px; }

/* ---- how the job actually runs ---- */
.track-plan { margin: 16px 0 6px; padding: 13px 15px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.track-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.track-when { flex: 0 0 62px; font-size: 11.5px; color: var(--muted); font-weight: 700; text-align: right; }
.track-bar { padding: 7px 12px; border-radius: 7px; font-size: 12.5px; color: #fff; font-weight: 600;
  background: var(--olive); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-bar.tk-tony { background: var(--gold); }
.track-bar.tk-curb { background: #6b7a52; }
.track-bar.tk-hvac { background: #6b7a52; }
.track-who { flex: 0 0 auto; font-size: 11px; color: var(--muted); white-space: nowrap; }
@media (max-width: 640px) { .track-who { display: none; } .track-when { flex-basis: 48px; } }

/* ---- cloud ---- */
.cloud-pill { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; padding: 3px 9px;
  border-radius: 20px; margin-right: 9px; cursor: default; }
.cloud-pill.ok   { background: rgba(61,122,68,.22); color: #b7e0bb; }
.cloud-pill.sync { background: rgba(175,136,65,.28); color: #f0d9a8; }
.cloud-pill.warn,
.cloud-pill.err  { background: rgba(192,57,43,.28); color: #f3bdb6; cursor: pointer; }
.cloud-pill.off  { background: rgba(255,255,255,.12); color: #cfc9ba; }
.cloud-status { padding: 12px 15px; border-radius: 10px; margin: 12px 0; font-size: 13px; line-height: 1.55;
  border-left: 3px solid var(--line); background: var(--paper); }
.cloud-status.ok   { border-left-color: var(--green); }
.cloud-status.warn { border-left-color: var(--gold); }
.cloud-status.off  { border-left-color: var(--muted); }
.cloud-steps { margin: 14px 0; padding-left: 22px; font-size: 13px; line-height: 1.75; }
.cloud-steps li { margin-bottom: 9px; }
.cloud-steps code { background: var(--paper); border: 1px solid var(--line); border-radius: 5px;
  padding: 2px 6px; font-size: 12px; display: inline-block; margin: 2px 0; }
.cloud-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin: 12px 0; }
.cloud-form label { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.cloud-form input { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }

/* ---- set-password screen ---- */
.btn-block { width: 100%; margin-top: 12px; }
.login-card label { display: block; margin-top: 12px; font-size: 12px; color: var(--muted); }
.login-card label input { width: 100%; margin-top: 4px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }

/* ---- crew app ---- */
.clock-card.is-on { border-left: 4px solid var(--green); }
.clock-big { font-size: 44px; font-weight: 800; color: var(--olive); line-height: 1.1; margin: 6px 0 2px; }
.clock-big span { font-size: 15px; font-weight: 600; color: var(--muted); }
.clock-jobs { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.clock-jobs .btn { text-align: left; padding: 14px 16px; font-size: 15px; }

/* ---- quotes on the dashboard ---- */
.quote-card { border-top: 3px solid var(--gold); }
.stage-pill { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; padding: 3px 9px;
  border-radius: 20px; text-transform: uppercase; }
.stage-quote    { background: rgba(122,119,110,.15); color: var(--muted); }
.stage-accepted { background: rgba(175,136,65,.18); color: var(--gold); }
.stage-active   { background: rgba(61,122,68,.15); color: var(--green); }
.stage-complete { background: rgba(58,59,54,.12); color: var(--olive); }
.stage-lost     { background: rgba(192,57,43,.13); color: var(--red); }

/* ---- new customer ---- */
.modal-wide { max-width: 620px; }
.nc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0 4px; }
@media (max-width: 620px) { .nc-grid { grid-template-columns: 1fr; } }
.nc-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.nc-grid input, .nc-grid select { padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; background: #fff; color: var(--ink); }
.req { color: var(--red); font-size: 10px; letter-spacing: .04em; }
.nc-stages { display: grid; gap: 8px; margin: 8px 0; }
.nc-stage { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: all .15s; }
.nc-stage:hover { border-color: var(--gold); }
.nc-stage:has(input:checked) { border-color: var(--olive); background: var(--paper); }
.nc-stage span { display: flex; flex-direction: column; gap: 2px; }
.nc-stage b { font-size: 13.5px; color: var(--ink); }
.nc-stage em { font-style: normal; font-size: 12px; color: var(--muted); }
.nc-sched { background: var(--paper); border-radius: 10px; padding: 11px 13px; margin: 6px 0; }
.nc-check { display: flex; gap: 9px; align-items: center; font-size: 13px; font-weight: 600; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

.hero-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
/* On a phone the header's button wraps under the text; without a real gap
   its bottom edge sat 2px into the search box below it (Team, at 375px). */
.hero-row + .filter-bar { margin-top: 4px; }
.cust-bar { display: flex; gap: 22px; flex-wrap: wrap; padding: 11px 15px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; font-size: 13px; }
.cust-bar b { color: var(--olive); font-size: 16px; margin-right: 4px; }

/* ---- accounting reconciliation ---- */
.cov-warn.cov-bad { border-left-color: var(--red); background: rgba(192,57,43,.06); }
.blind-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.blind-list span { background: #fff; border: 1px solid var(--line); border-radius: 7px;
  padding: 4px 10px; font-size: 12px; }
.recon-card { border-top: 3px solid var(--olive); }

/* ---- the books ---- */
.act-card { border-top: 3px solid var(--green); }
.act-3up { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 12px 0 4px; }
@media (max-width: 820px) { .act-3up { grid-template-columns: 1fr; } }
.act-col { background: var(--paper); border: 1px solid var(--line); border-radius: 11px; padding: 13px 15px; }
.act-col h3 { margin: 0 0 9px; font-size: 12px; color: var(--olive); }
.act-n { display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 4px 0; font-size: 13px; color: var(--muted); }
.act-n b { color: var(--ink); font-size: 14px; font-weight: 700; }
.act-n.big { border-top: 1px solid var(--line); margin-top: 5px; padding-top: 7px; }
.act-n.big b { font-size: 19px; }

/* ---- login PIN field ---- */
.pin-wrap { position: relative; display: block; }
.pin-wrap input { width: 100%; padding-right: 58px; }
.pin-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); font-size: 11px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; cursor: pointer; padding: 4px 6px; }
.pin-eye:hover { color: var(--olive); }
.login-reset { display: block; width: 100%; margin-top: 10px; text-align: center;
  font-size: 12px; color: var(--muted); background: none; border: none; cursor: pointer; }
.login-reset:hover { color: var(--olive); text-decoration: underline; }

/* ---- login credential chips ----
   Every account on the sign-in screen is a button now. The old list was
   plain text, so Noah pasted a whole hint line into the username box. */
.cred-row { display:flex; gap:8px; align-items:baseline; margin:6px 0; font-size:12px; }
.cred-row > b { flex:0 0 68px; color:var(--muted); font-weight:600; }
.cred-row > span { display:flex; flex-wrap:wrap; gap:6px; }
.cred-chip {
  border:1px solid var(--line); background:#fff; border-radius:999px;
  padding:3px 10px; font:inherit; font-size:12px; cursor:pointer; color:var(--ink);
}
.cred-chip span { color:var(--muted); margin-left:4px; font-variant-numeric:tabular-nums; }
.cred-chip:hover { border-color:var(--gold); background:#faf7f0; }

/* The sign-in screen no longer prints credentials, so it needs one quiet
   line telling someone what to do instead of a list of PINs. */
.login-help { margin:14px 0 0; text-align:center; font-size:12px; color:var(--muted); }

/* An unclosed shift is the one that costs money — make it obvious in the list. */
.row-open > td { background: #fff8e8; }
.rate-in { width: 62px; }

/* Quote status strip and the totals table in the builder. */
.quote-strip { margin: 10px 0 16px; }
.qtotals td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.qtotals tr.total td { border-top: 2px solid var(--ink); font-size: 15px; }

/* A scope someone is on, and the two buttons they press. */
.qs-row.is-running { background: #fffaf0; }
.qs-acts { display:flex; gap:6px; align-items:center; flex-shrink:0; }
.qs-acts .is-off { opacity:.45; }

/* The seven-day strip on the dashboard. */
.dp-week { display:flex; gap:6px; align-items:flex-end; margin:14px 0 8px; }
.dp-day { flex:1; text-align:center; }
.dp-bars { display:flex; gap:3px; align-items:flex-end; justify-content:center; height:70px; }
.dp-bar { width:12px; border-radius:3px 3px 0 0; min-height:2px; }
.dp-rev { background:var(--gold,#a98b43); }
.dp-cost { background:#c9c2b4; }
.dp-lbl { font-size:11px; color:var(--muted); margin-top:4px; }
.dp-num { font-size:11px; font-variant-numeric:tabular-nums; }

/* The review proof block in the client portal. */
.review-proof { display:flex; gap:20px; align-items:center; flex-wrap:wrap; }
.rp-score { text-align:center; flex:0 0 130px; }
.rp-stars { color:#e8b33a; font-size:20px; letter-spacing:2px; }
.rp-num { font-size:30px; font-weight:700; line-height:1.1; }
.rp-body { flex:1; min-width:220px; }
.rp-body h2 { margin:0 0 4px; }
@media (max-width:560px){ .review-proof { flex-direction:column; align-items:flex-start; } }

/* The crew's week strip on My Hours. */
.ct-week { display:flex; gap:6px; }
.ct-day { flex:1; text-align:center; padding:8px 4px; border:1px solid var(--line); border-radius:8px; }
.ct-day.is-today { border-color:var(--gold); background:#faf7f0; }
.ct-day.is-future { opacity:.4; }
.ct-dow { font-size:11px; color:var(--muted); }
.ct-hrs { font-size:17px; font-weight:600; font-variant-numeric:tabular-nums; }

/* The three-step acceptance gate in the client portal. */
.acc-steps { display:flex; flex-direction:column; gap:10px; margin:12px 0 18px; }
.acc-step { display:flex; gap:12px; padding:12px; border:1px solid var(--line); border-radius:10px; }
.acc-step.is-done { background:#f3f8f3; border-color:#cde0cd; }
.acc-step.is-next { border-color:var(--gold); background:#fffdf7; }
.acc-step.is-wait { opacity:.55; }
.acc-num { flex:0 0 28px; height:28px; border-radius:50%; background:var(--ink); color:#fff;
  display:flex; align-items:center; justify-content:center; font-weight:600; font-size:13px; }
.acc-step.is-done .acc-num { background:#3f7a3f; }
.acc-step.is-next .acc-num { background:var(--gold); }
.acc-body { flex:1; }
.legal-scroll { max-height:340px; overflow-y:auto; border:1px solid var(--line);
  border-radius:8px; padding:14px; margin:10px 0; font-size:13px; }
.legal-scroll h4 { margin:14px 0 4px; }

/* ---------------------------------------------------------------
   Dragging a scope up or down the build order.
   The row itself is the handle, so it needs to look grabbable and to
   show clearly where it will land. --------------------------------- */
.qs-row[draggable="true"] { cursor: grab; }
.qs-row[draggable="true"]:active { cursor: grabbing; }
.qs-dragging { opacity: .45; }
.qs-drop-target { box-shadow: inset 0 3px 0 0 var(--olive); }

/* ---------------------------------------------------------------
   Job photos. Real ones, from the camera, not a checkbox. ------- */
.photo-strip { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; margin-top: 10px; }
.photo-thumb { margin: 0; width: 132px; }
.photo-thumb img, .photo-ph { width: 132px; height: 99px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line); display: block; cursor: zoom-in; background: var(--card); }
.photo-ph { display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); cursor: default; }
.photo-thumb figcaption { font-size: 11px; line-height: 1.3; margin-top: 4px; }
.photo-thumb figcaption span { display: block; color: var(--muted); }

/* The real agreements are four pages each, so give the sections air. */
.legal-sec { margin: 14px 0; }
.legal-sec h4 { margin: 0 0 4px; font-size: 13px; letter-spacing: .02em; }
.legal-sec p { margin: 0 0 8px; }

/* =====================================================================
   TOASTS, SHEETS AND ASK-MODALS
   Replaces 138 native browser dialogs. See js/ui.js for why that was a
   correctness fix and not a paint job.
   ===================================================================== */
.toast-host { position: fixed; z-index: 400; right: 16px; bottom: 16px;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none; max-width: min(420px, calc(100vw - 32px)); }
.toast { pointer-events: auto; cursor: pointer; display: flex; gap: 10px; align-items: flex-start;
  background: #2a2b27; color: #fff; border-radius: 11px; padding: 11px 14px;
  font-size: 13.5px; line-height: 1.45; box-shadow: 0 6px 24px rgba(0,0,0,.26);
  animation: toast-in .22s cubic-bezier(.2,.9,.3,1); }
.toast.out { animation: toast-out .3s forwards; }
.toast-mark { flex: 0 0 18px; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; margin-top: 1px; }
.toast-ok   .toast-mark { background: #6f9f4a; color: #fff; }
.toast-warn .toast-mark { background: #d9a13b; color: #2a2b27; }
.toast-err  .toast-mark { background: #c45c48; color: #fff; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(6px) scale(.98); } }
@media (max-width: 620px) {
  .toast-host { left: 12px; right: 12px; bottom: 12px; align-items: stretch; max-width: none; }
}

.modal-note, .modal-ask { max-width: 480px; }
.modal-note p, .modal-ask p.sub { margin: 0 0 10px; }
.modal-ask label { display: block; margin: 0 0 12px; position: relative; }
.modal-ask .req { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; opacity: .6; }
.modal-ask .money-pre { position: absolute; left: 10px; top: 29px; opacity: .55; font-size: 14px; }
.modal-ask .money-pre + input { padding-left: 22px; }
.modal-ask .muted { display: block; margin-top: 3px; font-size: 12px; }

.check-row { display: flex; gap: 9px; align-items: flex-start; margin: 0 0 14px; cursor: pointer; }
.check-row input[type=checkbox] { flex: 0 0 auto; width: 17px; height: 17px; margin-top: 2px; }
.check-row span { font-size: 13.5px; line-height: 1.5; }

.portal-legal { border-top: 1px solid var(--rule, #d8d4cb); margin: 34px 0 0;
  padding: 18px 20px 30px; font-size: 12.5px; line-height: 1.7;
  color: var(--mute, #5f6158); text-align: center; }
.portal-legal a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.portal-legal a:hover { color: var(--accent, #6f9f4a); }

/* Books-vs-dashboard reconciliation strip */
.recon-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px; margin: 14px 0 4px; }
.recon-cell .stat-n { font-size: 26px; margin: 2px 0 4px; }
.recon-cell .muted { font-size: 12px; line-height: 1.5; }
.recon-gap { margin-top: 14px; }
.recon-note { font-size: 12.5px; margin-top: 10px; line-height: 1.6; }

/* ---- page header with a primary action ---- */
.page-head { display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin: 0 0 14px; }
.page-head h1 { margin: 0; }

/* ---- filter bar: segmented control + search + sort ---- */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }
.seg { display: inline-flex; background: rgba(0,0,0,.05); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-b { border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 13px;
  padding: 7px 12px; border-radius: 8px; color: var(--mute, #5f6158); white-space: nowrap; }
.seg-b:hover { background: rgba(0,0,0,.05); }
.seg-b.on { background: #fff; color: var(--ink, #2a2b27); font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg-n { display: inline-block; margin-left: 5px; font-size: 11px; opacity: .6; }
.filter-q { flex: 1 1 240px; min-width: 180px; padding: 9px 12px; font-size: 14px;
  border: 1px solid var(--rule, #d8d4cb); border-radius: 10px; background: #fff; }
.filter-s { padding: 9px 10px; font-size: 13px; border: 1px solid var(--rule, #d8d4cb);
  border-radius: 10px; background: #fff; }
.list-head { display: flex; justify-content: flex-end; font-size: 12px; margin: -4px 0 8px; }

/* ---- empty states that tell you what to do next ---- */
.empty-state { text-align: center; padding: 34px 20px; }
.empty-state p { margin: 0 0 8px; }
.empty-state .muted { max-width: 440px; margin: 0 auto 16px; font-size: 13.5px; line-height: 1.6; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
@media (max-width: 620px) {
  .filter-bar { gap: 8px; }
  .seg { width: 100%; overflow-x: auto; }
  .filter-q { flex-basis: 100%; }
}

/* Budget / Reported / Bank actual */
.tbl-scroll { overflow-x: auto; }
.threecol td.num, .threecol th { text-align: right; }
.threecol td:first-child, .threecol th:first-child { text-align: left; }
.threecol .neg { color: #c45c48; font-weight: 600; }
.alert-line.ok { background: #f1f5ec; border-color: #9ec47a; }

.selfcheck-line { background: #fff6e5; border-color: #e8c77a; margin-bottom: 14px; }

/* Communication dashboard */
.comms-tbl td { vertical-align: top; }
.thread { display: flex; flex-direction: column; gap: 9px; max-height: 460px; overflow-y: auto;
  padding: 12px; background: rgba(0,0,0,.03); border-radius: 10px; }
.msg { max-width: 76%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; }
.msg-out { align-self: flex-end; background: #6f9f4a; color: #fff; border-bottom-right-radius: 4px; }
.msg-in { align-self: flex-start; background: #fff; border: 1px solid var(--rule,#d8d4cb); border-bottom-left-radius: 4px; }
.msg-meta { font-size: 11px; opacity: .7; margin-top: 4px; }

/* Quote builder */
.qb-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.qb-tbl td { vertical-align: top; }
.qb-tbl td.num { text-align: right; }
.qb-move { white-space: nowrap; }
.qb-move .link { padding: 0 3px; font-size: 15px; }
.qb-move .link[disabled] { opacity: .25; cursor: default; }
.qb-qty, .qb-price { width: 100%; padding: 7px 9px; border: 1px solid var(--rule,#d8d4cb);
  border-radius: 8px; font-size: 14px; text-align: right; }
.qb-calc { font-size: 13px; font-weight: 600; margin-top: 3px; }
.qb-add { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule,#d8d4cb); }
.qb-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.qb-chip { border: 1px solid var(--rule,#d8d4cb); background: #fff; border-radius: 999px;
  padding: 7px 13px; font-size: 13px; cursor: pointer; font-family: inherit; }
.qb-chip:hover { border-color: var(--accent,#6f9f4a); color: var(--accent,#6f9f4a); }
.qb-chip.on { background: #f1f5ec; border-color: #9ec47a; }
.qb-totals .stat-n { font-size: 27px; }

/* ---- the client picker ---- */
.modal-pick{max-width:560px; display:flex; flex-direction:column; max-height:84vh}
.pk-q{width:100%; padding:11px 13px; font-size:15px; border:1px solid var(--rule,#d8d4cb);
  border-radius:10px; background:#fff; margin:4px 0 10px}
.pk-list{flex:1; overflow-y:auto; min-height:180px; margin:0 -4px; padding:0 4px}
.pk-head{font-size:10.5px; letter-spacing:.09em; text-transform:uppercase; color:var(--mute,#5f6158);
  margin:12px 0 6px; font-weight:600}
.pk-head:first-child{margin-top:0}
.pk-row{display:flex; width:100%; align-items:center; gap:10px; justify-content:space-between;
  text-align:left; background:#fff; border:1px solid var(--rule,#d8d4cb); border-left:3px solid transparent;
  border-radius:9px; padding:9px 12px; margin-bottom:5px; cursor:pointer; font:inherit; font-size:14px}
.pk-row:hover,.pk-row:focus-visible{border-color:var(--accent,#6f9f4a); background:#f7faf4}
.pk-main{display:flex; flex-direction:column; gap:1px; min-width:0}
.pk-sub{font-size:12px; color:var(--mute,#5f6158); overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.pk-none{padding:26px 8px; text-align:center; color:var(--mute,#5f6158); font-size:14px}
.pk-more{font-size:12px; color:var(--mute,#5f6158); padding:6px 2px 2px}
.exp-job.exp-find{border-left-color:var(--accent,#6f9f4a); font-weight:600}

/* ---- customer profile ---- */
.crumb{margin:0 0 6px; font-size:13px}
.crumb a{color:var(--mute,#5f6158); text-decoration:none}
.crumb a:hover{color:var(--accent,#6f9f4a)}
.cust-contact{font-size:14px; margin-top:4px}
.cust-contact a{color:inherit}
.head-actions{display:flex; gap:8px; flex-wrap:wrap}
.g2-cards{display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:16px}
.g2-cards .card{margin:0}
.cust-msg{padding:9px 0; border-bottom:1px solid var(--rule,#d8d4cb); font-size:14px}
.cust-msg:last-of-type{border-bottom:0}
.cust-note{padding:9px 0; border-bottom:1px solid var(--rule,#d8d4cb); font-size:14px}
.cust-note:last-of-type{border-bottom:0}
.cust-consent{margin-top:12px; padding-top:12px; border-top:1px solid var(--rule,#d8d4cb); font-size:13.5px}
.consent-acts{margin-top:6px; display:flex; flex-wrap:wrap; gap:4px 10px}
.consent-acts .link{font-size:13px}
.tbl td.num,.tbl th.num{text-align:right}
@media (max-width:760px){ .g2-cards{grid-template-columns:1fr} }

/* ---- booking ---- */
.modal-book{max-width:520px}
.book-door{display:block; width:100%; text-align:left; background:#fff; font:inherit; cursor:pointer;
  border:1px solid var(--rule,#d8d4cb); border-radius:11px; padding:15px 17px; margin:0 0 10px}
.book-door:hover:not(.off){border-color:var(--accent,#6f9f4a); background:#f7faf4}
.book-door b{display:block; font-size:15.5px; margin-bottom:4px}
.book-door span{display:block; font-size:13px; color:var(--mute,#5f6158); line-height:1.5}
.book-door.off{opacity:.55; cursor:default}
.modal-sbs{max-width:640px}
#sbs-list{max-height:52vh; overflow-y:auto; margin:4px -2px 0; padding:0 2px}
.sbs-row{display:grid; grid-template-columns:1fr auto auto; gap:12px; align-items:center;
  border:1px solid var(--rule,#d8d4cb); border-left:3px solid var(--rule,#d8d4cb);
  border-radius:9px; padding:9px 12px; margin-bottom:6px}
.sbs-row.on{border-left-color:var(--accent,#6f9f4a); background:#f7faf4}
.sbs-main b{display:block; font-size:14px}
.sbs-main span{font-size:12px}
.sbs-when{font-size:13px; white-space:nowrap}
.sbs-act{display:flex; gap:7px; align-items:center; white-space:nowrap}
.book-banner{margin-bottom:14px}
@media (max-width:620px){ .sbs-row{grid-template-columns:1fr; gap:6px} }

/* ===== THE SCOREBOARD — the five that matter ===== */
.sb{border-top:4px solid var(--gold)}
.sb-head h2{margin:0 0 2px}
.sb-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(176px,1fr)); gap:12px; margin:14px 0 4px}
/* Five is an awkward number for a grid: at a wider minimum the fifth tile drops
   alone onto a second row with three empty cells beside it. 176px lets all five
   sit across on a laptop and fall to three, then one, below that. */
.sb-tile{border:1px solid var(--line); border-radius:11px; padding:13px 14px; background:#fcfbf8}
.sb-tile.sb-cash{border-left:4px solid var(--olive); background:#fff}
.sb-tile.sb-lever{border-left:4px solid var(--gold); background:#fffdf7}
.sb-l{font-size:11px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.7px}
.sb-n{font-size:30px; font-weight:800; color:var(--olive); line-height:1.1; margin:4px 0 6px; font-variant-numeric:tabular-nums}
.sb-s{font-size:12.5px; color:var(--muted); line-height:1.45}
.sb-s b{color:var(--ink)} .sb-s b.neg{color:var(--red)}
.sb-warn{border-left:4px solid var(--orange); background:#fff6f1; padding:10px 12px; border-radius:8px;
         border-bottom:none; margin-top:12px; font-size:13px}
.sb-div{margin-top:14px; border-top:1px solid var(--line); padding-top:12px}
.sb-divrow{display:grid; grid-template-columns:165px 1fr 150px; gap:12px; align-items:center; padding:5px 0}
.sb-divname{display:flex; flex-direction:column; line-height:1.3}
.sb-divname span{font-size:11.5px}
.sb-bar{height:8px; background:#eceae4; border-radius:5px; overflow:hidden}
.sb-bar i{display:block; height:100%; background:linear-gradient(90deg,var(--gold),var(--gold-l)); border-radius:5px}
.sb-divn{text-align:right; font-weight:700; font-variant-numeric:tabular-nums}
.sb-divn span{display:block; font-weight:500; font-size:11.5px}
/* On a phone the three-column row has to become two lines. Named areas rather
   than a span, because auto-placement put the money column after the bar and
   collapsed it to zero width. */
@media (max-width:620px){
  .sb-divrow{grid-template-columns:1fr auto; grid-template-areas:"name money" "bar bar"; gap:5px 10px}
  .sb-divname{grid-area:name} .sb-bar{grid-area:bar} .sb-divn{grid-area:money}
  .sb-n{font-size:26px}
  .map-foot a{margin-left:0}
}

/* ===== THE MAP — new-mover pins ===== */
.map-wrap{border:1px solid var(--line); border-radius:10px; overflow:hidden; background:var(--map-ground,#eef0e9)}
.map-svg{display:block; width:100%; height:auto}
.map-legend{display:flex; flex-wrap:wrap; gap:7px 14px; margin:11px 0 4px; font-size:12.5px; color:var(--muted)}
.map-key{display:inline-flex; align-items:center; gap:5px}
.map-key i{width:9px; height:9px; border-radius:50%; display:inline-block; box-shadow:0 0 0 1.5px #fff}
.map-key b{color:var(--ink)}
.map-foot{display:flex; flex-wrap:wrap; gap:6px 18px; align-items:baseline; font-size:13px;
          border-top:1px solid var(--line); margin-top:9px; padding-top:9px}
.map-foot b{color:var(--olive)} .map-foot .neg b{color:var(--red)}
.map-foot a{margin-left:auto; font-weight:600}
.xs{font-size:11.5px; color:var(--muted); margin:7px 0 0; line-height:1.4}

/* ===== THE REST OF THE DETAIL — kept, not deleted, just folded away ===== */
.fold{border:1px solid var(--line); border-radius:12px; background:var(--card); margin:14px 0; overflow:hidden}
.fold>summary{padding:14px 18px; cursor:pointer; font-weight:700; color:var(--olive); list-style:none;
              display:flex; align-items:baseline; gap:10px}
.fold>summary::-webkit-details-marker{display:none}
.fold>summary::after{content:'▸'; margin-left:auto; color:var(--muted); font-weight:400; transition:transform .18s}
.fold[open]>summary::after{transform:rotate(90deg)}
.fold>summary span{font-weight:400; font-size:12.5px; color:var(--muted)}
.fold>summary:hover{background:#fcfbf8}
.fold-body{padding:0 18px 16px; border-top:1px solid var(--line)}
.fold-body>.card{border:none; box-shadow:none; padding:14px 0; margin:0; animation:none}
.fold-body>.card+.card{border-top:1px dashed var(--line)}
.sb-note{border-left:4px solid var(--line); background:#fcfbf8; padding:10px 12px; border-radius:8px;
         border-bottom:none; margin-top:9px; font-size:13px; color:var(--muted)}
.sb-note b{color:var(--ink)}
/* ===== EDITING ROWS — payments, and anything else with per-row actions ===== */
.row-acts{white-space:nowrap; text-align:right}
.row-acts .btn{margin-left:5px}
.btn-quiet{background:transparent; border-color:var(--line); color:var(--muted)}
.btn-quiet:hover{color:var(--red); border-color:var(--red)}
.pay-stated td{background:#fcfbf8}
.pay-stated span.muted{display:block; font-size:11.5px; font-weight:400}
/* ===== CHANGE ORDERS ===== */
.co-row{display:grid; grid-template-columns:1fr 120px auto; gap:12px; align-items:start;
        padding:11px 0; border-bottom:1px dashed var(--line)}
.co-row:last-child{border-bottom:none}
.co-main b{display:inline-block; margin-right:7px}
.co-main .muted{font-size:12.5px; line-height:1.45; margin-top:3px}
.co-amt{text-align:right; font-weight:700; font-variant-numeric:tabular-nums}
.co-amt span{display:block; font-weight:500; font-size:11.5px}
.co-act{white-space:nowrap}
.co-doc{background:#fcfbf8; border:1px solid var(--line); border-radius:8px; padding:14px 16px;
        font-size:13px; line-height:1.6; max-height:340px; overflow-y:auto; margin:10px 0 14px}
.co-invoice{border-left:4px solid var(--gold)}
@media (max-width:620px){ .co-row{grid-template-columns:1fr auto; gap:4px 10px}
  .co-act{grid-column:1/-1; margin-top:6px} }
.qb-chip-svc{border-style:dashed}
.qb-chip-opt{border-style:dotted; opacity:.85}
.qb-unit{display:flex; align-items:center; gap:4px; white-space:nowrap}
.qb-unit input{width:84px}
.qb-line-total{font-size:12.5px; margin-top:3px; font-variant-numeric:tabular-nums}
.qb-lot{border-left:4px solid var(--gold)}
.qb-lot-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:10px 14px}
.qb-lot-grid label{font-size:12px; color:var(--muted); display:flex; flex-direction:column; gap:3px}
.qb-lot-grid input{padding:7px 9px; border:1px solid var(--line); border-radius:7px; font-size:14px}
.qb-lot-grid .muted{font-size:11px}

.qb-kitchen{margin-top:12px; padding-top:12px; border-top:1px dashed var(--line)}
.qb-kitchen .sub{margin:4px 0 10px}
.qb-checks{display:flex; flex-wrap:wrap; gap:8px 18px; margin-top:10px}
.qb-check{display:flex; align-items:center; gap:6px; font-size:13px}
.qb-profit-good{color:var(--green); font-weight:600}
.qb-profit-near{color:#9a6b00; font-weight:600}
.qb-profit-bad{color:var(--red); font-weight:600}
.pipe-board{display:grid; grid-auto-flow:column; grid-auto-columns:minmax(230px,1fr); gap:12px; overflow-x:auto; padding-bottom:8px; align-items:start}
.pipe-col{background:var(--card,#fff); border:1px solid var(--line); border-radius:12px; padding:10px; min-height:120px}
.pipe-head{padding:2px 4px 8px; border-bottom:1px solid var(--line); margin-bottom:8px}
.pipe-card{display:block; padding:10px; border:1px solid var(--line); border-radius:10px; margin:8px 0; color:var(--ink); background:var(--bg,#fafafa); font-size:13px}
.pipe-card:hover{border-color:var(--gold); text-decoration:none}
.pipe-card.stale{border-color:#d9b24c}
.pipe-card-top{display:flex; justify-content:space-between; gap:8px}
.pipe-card-foot{margin-top:6px; font-size:12px}
.pipe-empty{padding:12px 4px; font-size:12px}
.row-warn td{background:#fff8e6}
.row-muted td{color:var(--muted)}
.head-actions{display:flex; gap:8px; flex-wrap:wrap; align-items:center}

/* ------------------------------------------------------------------
   PHONES: nothing may push the page sideways.
   Checked at 375px across Customers, Team, Books and Quote — a bare
   table inside a card and a row of buttons in a page head were both
   dragging the whole page right, which on a phone reads as the layout
   being broken. The table keeps its columns and scrolls inside its own
   card; the buttons wrap.
   ------------------------------------------------------------------ */
@media (max-width: 760px) {
  .card { overflow-x: auto; }
  .page-head { flex-wrap: wrap; gap: 10px; }
  .page-head > div { flex-wrap: wrap; }
  .head-actions { flex-wrap: wrap; }
  .filter-bar { flex-wrap: wrap; }
  .filter-q { min-width: 0; flex: 1 1 100%; }
}
