/* Kearsley app. One set of colors, sizes and parts used on every screen. Always light. */
:root {
  --brand: #243e90; --brand-600: #1c3175; --brand-50: #eef2fb; --brand-text: #2b4bb0; --y: #fde000;
  --bg: #f4f6fa; --card: #fff; --soft: #f7f8fb; --ink: #101a36; --text: #3a4560; --mute: #6a7590;
  --line: #e3e7ef; --line-2: #cfd6e3;
  --ok: #12805c; --ok-50: #e7f5ee; --warn: #c2500c; --warn-50: #fdf1e7; --bad: #c42b2b; --bad-50: #fdeded;
  --ok-btn: #12805c; --ok-btn-h: #0e6c4d; --warn-btn: #c2500c; --warn-btn-h: #a9450a; --bad-btn: #c42b2b;
  --r: 14px; --r-sm: 9px;
  --sh-1: 0 1px 2px rgba(16, 26, 54, .05); --sh-2: 0 10px 30px rgba(16, 26, 54, .12);
  --side: 240px; --tab: 62px;
  /* older names still used in a few places */
  --blue: var(--brand); --blue-2: var(--brand-text);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--ink); line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; font-weight: 700; margin: 0 0 18px; }
h1 small { font-size: .95rem; font-weight: 500; color: var(--mute); margin-left: 8px; letter-spacing: 0; }
h2 { font-size: 1.02rem; font-weight: 650; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
h2 > .i { color: var(--mute); width: 18px; height: 18px; }
h2 small { font-weight: 500; color: var(--mute); font-size: .85rem; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.pre { white-space: pre-wrap; }
.warn { color: var(--warn); }

/* Icons */
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- App frame: sidebar on computers, tab bar on phones ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border-right: 1px solid var(--line); padding: 18px 12px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; color: var(--ink); font-weight: 750; font-size: 1.1rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .navbtn, .sheet a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--text);
  font-weight: 550; font-size: .95rem; }
.nav a .i, .navbtn .i, .sheet a .i { color: var(--mute); }
.nav a:hover, .navbtn:hover, .sheet a:hover { background: var(--soft); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--brand-50); color: var(--brand-text); }
.nav a[aria-current="page"] .i { color: var(--brand-text); }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 2px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); color: var(--ink); }
.me:hover { background: var(--soft); text-decoration: none; }
.me span:last-child { display: grid; line-height: 1.25; min-width: 0; }
.me b { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: var(--mute); font-size: .78rem; }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff;
  font-size: .8rem; font-weight: 700; letter-spacing: .02em; }
a.avatar:hover { text-decoration: none; }
.side .navbtn, .sheet .navbtn { width: 100%; height: auto; padding: 9px 12px; gap: 12px; justify-content: flex-start; background: none; border: 0; cursor: pointer; font: inherit; font-size: .95rem; font-weight: 550; color: var(--text); text-align: left; }
.side .navbtn:hover, .sheet .navbtn:hover { background: var(--soft); }
.side form, .sheet form { margin: 0; }
.topbar, .tabbar { display: none; }

body.app main { margin-left: var(--side); padding: 28px 36px 72px; max-width: calc(var(--side) + 1240px); }
/* Medium windows (half screen, tablet): a slim sidebar with just the icons. */
@media (min-width: 700px) and (max-width: 1099px) {
  :root { --side: 76px; }
  .side { padding: 16px 10px; align-items: center; }
  .side .brand { padding: 4px 0 14px; }
  .side .brand span, .side .nav a span, .side .me span:last-child, .side .navbtn span { display: none; }
  .side .nav a, .side .navbtn { justify-content: center; padding: 11px 0; width: 52px; }
  .side .side-foot { width: 100%; justify-items: center; }
  .side .me { padding: 6px; }
  body.app main { padding: 24px 24px 64px; }
}
body.bare main { max-width: 440px; margin: 0 auto; padding: 10vh 16px 48px; }

@media (max-width: 699px) {
  .side { display: none; }
  /* No app header on phones: every page has its own title, and My account is under More. */
  .topbar { display: none; position: sticky; top: 0; z-index: 30; align-items: center; justify-content: space-between;
    padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: color-mix(in srgb, var(--card) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; font-size: 1.02rem; }
  .topbar .avatar { width: 32px; height: 32px; }
  /* Room at the top: the iPhone blurs whatever scrolls under the clock and battery, so titles start well below it. */
  :root { --top-gap: calc(env(safe-area-inset-top) + 30px); }
  body.app main { margin: 0; padding: var(--top-gap) 16px calc(var(--tab) + 32px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); position: fixed; inset: auto 0 0 0; z-index: 40;
    height: calc(var(--tab) + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--card) 92%, transparent); -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
    border-top: 1px solid var(--line); }
  .tabbar > a, .more > summary { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: var(--tab);
    color: var(--mute); font-size: .68rem; font-weight: 600; list-style: none; cursor: pointer; }
  .more > summary { margin: 0; }
  .more > summary::-webkit-details-marker { display: none; }
  .tabbar > a:hover { text-decoration: none; }
  .tabbar .i { width: 23px; height: 23px; }
  .tabbar > a[aria-current="page"], .more > summary[aria-current="page"], .more[open] > summary { color: var(--brand-text); }
  .more { position: relative; }
  .sheet { position: absolute; right: 4px; bottom: calc(var(--tab) + 6px); width: 230px; padding: 6px; background: var(--card);
    border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-2); display: grid; gap: 2px; }
  .sheet a[aria-current="page"] { color: var(--brand-text); background: var(--brand-50); }
  h1 { font-size: 1.35rem; }
}

/* ---------- Buttons: primary (navy), ghost (outlined), done (green), part-btn (orange), danger-btn (red) ---------- */
:where(.app, .bare) :is(button, .btn) {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: var(--r-sm); border: 1px solid transparent; background: var(--brand); color: #fff;
  font: inherit; font-weight: 600; font-size: .92rem; line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color .15s, border-color .15s, box-shadow .15s; }
:where(.app, .bare) :is(button, .btn):hover { background: var(--brand-600); text-decoration: none; }
:where(.app, .bare) :is(button, .btn):focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-text) 40%, transparent); }
:where(.app, .bare) :is(button, .btn) .i { width: 18px; height: 18px; }
:where(.app, .bare) :is(button, .btn)[disabled] { opacity: .4; cursor: default; }
:where(.app, .bare) :is(button, .btn).ghost { background: var(--card); color: var(--ink); border-color: var(--line-2); }
:where(.app, .bare) :is(button, .btn).ghost:hover { background: var(--soft); }
:where(.app, .bare) :is(button, .btn).ghost .i { color: var(--mute); }
:where(.app, .bare) :is(button, .btn).done, .btn.pay-top { background: var(--ok-btn); color: #fff; }
:where(.app, .bare) :is(button, .btn).done:hover, .btn.pay-top:hover { background: var(--ok-btn-h); }
:where(.app, .bare) :is(button, .btn).part-btn { background: var(--warn-btn); color: #fff; }
:where(.app, .bare) :is(button, .btn).part-btn:hover { background: var(--warn-btn-h); }
:where(.app, .bare) :is(button, .btn).danger-btn { background: var(--bad-btn); color: #fff; }
:where(.app, .bare) :is(button, .btn).small { height: 32px; padding: 0 11px; font-size: .84rem; gap: 6px; }
:where(.app, .bare) :is(button, .btn).small .i { width: 16px; height: 16px; }
:where(.app, .bare) :is(button, .btn).big { height: 48px; padding: 0 20px; font-size: 1rem; border-radius: 11px; }
:where(.app, .bare) :is(button, .btn).big .i { width: 20px; height: 20px; }
:where(.app, .bare) :is(button, .btn).icon-only { width: 40px; padding: 0; }
:where(.app, .bare) :is(button, .btn).small.icon-only { width: 32px; }
:where(.app, .bare) :is(button, .btn).x:hover { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line-2)); background: var(--bad-50); }
:where(.app, .bare) :is(button, .btn).x:hover .i { color: var(--bad); }
:where(.app, .bare) button.link { background: none; border: 0; height: auto; padding: 0; color: var(--brand-text); font-weight: 600; }
:where(.app, .bare) button.link:hover { background: none; text-decoration: underline; }
:where(.app, .bare) button.danger-link { color: var(--bad); }
:where(.app, .bare) button.ghost-neutral { background: var(--card); color: var(--ink); border-color: var(--line-2); }
.chip-btn { font: inherit; font-size: .84rem; font-weight: 600; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); cursor: pointer; }
.chip-btn:hover { border-color: var(--brand-text); color: var(--brand-text); background: var(--brand-50); }

/* ---------- Forms ---------- */
form label { display: block; margin-bottom: 16px; font-weight: 600; color: var(--ink); font-size: .87rem; }
input, select, textarea { display: block; width: 100%; margin-top: 6px; height: 42px; padding: 0 12px; font: inherit; font-size: .95rem;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--card); color: var(--ink);
  transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236a7590' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 18px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-text) 22%, transparent); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--mute) 75%, transparent); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); flex: none; }
input[type="file"] { height: auto; padding: 8px; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 550; }
.grid2, .grid3 { display: grid; gap: 0 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.actions { display: flex; gap: 16px; align-items: center; margin-top: 8px; }
fieldset.methods { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 8px; }
fieldset.methods legend { font-weight: 600; color: var(--ink); margin-bottom: 8px; font-size: .87rem; padding: 0; }
fieldset.methods label { margin: 0; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border: 1px solid var(--line-2);
  border-radius: var(--r-sm); cursor: pointer; font-weight: 550; background: var(--card); }
fieldset.methods label:has(input:checked) { border-color: var(--brand-text); background: var(--brand-50); color: var(--brand-text);
  box-shadow: inset 0 0 0 1px var(--brand-text); }
details summary { cursor: pointer; color: var(--brand-text); font-weight: 600; margin: 8px 0 12px; }
form.card h2 { margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
form.card h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } .grid3 { grid-template-columns: 1fr 1fr; } .grid3 label:first-child { grid-column: 1 / -1; } }

/* Phones: text boxes at 16px so iPhone doesn't zoom in when you tap one; no double-tap zoom in the app. */
@media (max-width: 760px) {
  input, select, textarea, .item input, .item textarea, form.add-email input, .part-note input { font-size: 16px; }
}
body.app { touch-action: manipulation; }
/* No sideways "go back" swipe from Chrome on Android; the calendar swipe below changes days instead. */
/* No rubber-band bounce: pages stop at the top and bottom, and a page that fits the screen doesn't move at all. */
html:has(body.app), body.app { overscroll-behavior: none; }
.tg-wrap, .mg { transition: transform .16s ease-out, opacity .16s ease-out; }
.swipe-left { transform: translateX(-40px); opacity: .4; }
.swipe-right { transform: translateX(40px); opacity: .4; }

/* ---------- Cards, headings, messages ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 16px; box-shadow: var(--sh-1); }
.narrow { max-width: 520px; }
main > .narrow:only-child, main > .flash + .narrow { margin-inline: auto; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head h1 { margin: 0; display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
.card .head { margin-bottom: 12px; }
.card .head h2 { margin: 0; }
.hint { color: var(--mute); font-size: .86rem; margin: 0 0 12px; }
.card > .hint:last-child { margin-bottom: 0; }
.section-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); margin: 0 0 10px; }
.flash { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-radius: var(--r-sm); margin: 0 0 16px; font-weight: 600; font-size: .92rem;
  border: 1px solid transparent; }
.flash.ok { background: var(--ok-50); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash.bad { background: var(--bad-50); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.empty { display: grid; justify-items: center; gap: 6px; padding: 36px 20px; text-align: center; color: var(--mute); }
.empty .i { width: 30px; height: 30px; color: color-mix(in srgb, var(--mute) 70%, transparent); }
.empty p { margin: 0; max-width: 360px; }
.auth { text-align: left; }
.auth-logo { display: block; margin: 4px 0 14px; }
.auth h1 { font-size: 1.35rem; }
.auth button { width: 100%; height: 46px; }
.cols { display: grid; gap: 0 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .cols { grid-template-columns: 1fr; } }

/* Status chips */
.chip { display: inline-flex; align-items: center; height: 22px; font-size: .74rem; font-weight: 650; padding: 0 9px; border-radius: 99px;
  background: color-mix(in srgb, var(--c, #64748b) 13%, transparent); color: var(--c, #64748b); vertical-align: middle; white-space: nowrap; letter-spacing: .01em; }
.s-requested { --c: #b45309; } .s-scheduled { --c: #2b4bb0; } .s-en_route { --c: #6d3fd6; } .s-in_progress { --c: #0f766e; }
.s-waiting_parts { --c: #c2500c; } .s-completed { --c: #12805c; } .s-canceled { --c: #6b7280; } .s-online { --c: #0e7490; }
.l-scheduled { --c: #2b4bb0; } .l-enroute { --c: #6d3fd6; } .l-complete { --c: #12805c; } .l-canceled { --c: #6b7280; }

/* Tables */
table.list { width: 100%; border-collapse: collapse; font-size: .92rem; }
.list th, .list td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); }
.list th { color: var(--mute); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.list tbody tr:hover td { background: var(--soft); }
.list tr.off td { color: var(--mute); }
.list td small { color: var(--mute); }
@media (max-width: 640px) {
  .list thead { display: none; }
  .list tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .list td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 0; text-align: right; }
  .list td[data-l]::before { content: attr(data-l); color: var(--mute); font-size: .82rem; text-align: left; }
  .list tbody tr:hover td { background: none; }
}
.search { display: flex; gap: 8px; margin-bottom: 18px; }
.search input { margin: 0; height: 46px; font-size: 1rem; padding-left: 40px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236a7590' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") no-repeat 12px center / 18px; }
.search button { height: 46px; }
.facts { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: .93rem; }
.facts dt { color: var(--mute); font-size: .86rem; }
.facts dd { margin: 0; color: var(--ink); }
ul.plain { list-style: none; padding: 0; margin: 0 0 12px; }
ul.plain li { padding: 10px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }

/* Stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--sh-1); display: flex; flex-direction: column; gap: 2px; }
.tile span { color: var(--mute); font-size: .8rem; font-weight: 650; order: -1; }
.tile b { font-size: 1.7rem; color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile small { color: var(--mute); font-size: .8rem; }
a.tile, a.tile.link { text-decoration: none; color: inherit; transition: border-color .15s; }
a.tile:hover { border-color: var(--brand-text); }
a.tile.link::after { content: 'See every unpaid job ›'; font-size: .8rem; color: var(--brand-text); font-weight: 600; margin-top: 2px; }

/* ---------- Job lists (Today, customer, dashboard) ---------- */
.jobs { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.job { position: relative; display: grid; gap: 3px; padding: 14px 16px 14px 18px; border: 1px solid var(--line); border-radius: var(--r);
  text-decoration: none; color: var(--text); background: var(--card); box-shadow: var(--sh-1); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.job::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c, var(--line-2)); }
.job:hover { text-decoration: none; border-color: var(--line-2); box-shadow: var(--sh-2); }
.job b { color: var(--ink); font-size: 1.02rem; }
.job .when, .job .where { display: flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--mute); }
.job .when .i, .job .where .i { width: 15px; height: 15px; }
.job .jtop { font-weight: 650; color: var(--c, var(--ink)); margin-top: 4px; }
.job .chip { position: absolute; top: 12px; right: 12px; }
.job.s-canceled, .job.s-completed { opacity: .75; }

/* Calendar events (days off, holidays, appointments) */
.evt { display: block; border-radius: 6px; font-size: .74rem; font-weight: 650; color: #4b5563; text-decoration: none;
  background: repeating-linear-gradient(135deg, #eef0f4 0 6px, #e4e7ee 6px 12px); border: 1px solid #d5d9e2; padding: 3px 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evt:hover { text-decoration: none; border-color: var(--line-2); color: var(--ink); }
.evt.all { background: repeating-linear-gradient(135deg, #fdf1e7 0 6px, #fbe6d4 6px 12px); border-color: #f2c9a7; color: #9a3f08; }
.evt.block { position: absolute; left: 2px; right: 2px; z-index: 1; display: grid; align-content: start; gap: 1px; white-space: normal; }
.evt.block small { font-weight: 500; opacity: .85; }
.evt.mini { font-size: .68rem; padding: 1px 5px; }
.evt.block.allday { z-index: 0; padding: 8px 9px; font-size: .8rem; align-content: start; opacity: .95; }
.mg-day.allday { background: repeating-linear-gradient(135deg, #f4f5f8 0 8px, #eceef3 8px 16px); }
.mg-day.allday-all { background: repeating-linear-gradient(135deg, #fdf5ee 0 8px, #fbe9da 8px 16px); }
.og-cell .og-evt { border-left-color: #9ca3af; background: repeating-linear-gradient(135deg, #eef0f4 0 5px, #e4e7ee 5px 10px); color: #4b5563; }
.og-cell.blocked { background: repeating-linear-gradient(135deg, #fdf1e7 0 6px, #fbe6d4 6px 12px); cursor: not-allowed; }
.today-evts { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.today-evts li { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--r-sm); font-size: .9rem;
  background: repeating-linear-gradient(135deg, #f4f5f8 0 8px, #eceef3 8px 16px); border: 1px solid var(--line); color: var(--ink); }
.today-evts .i { width: 17px; height: 17px; color: var(--mute); }
.today-evts span { color: var(--mute); }
.event-form [data-time] { transition: opacity .15s; }

/* Today: one section per tech */
.tech-day { margin-bottom: 22px; }
.tech-day h2 { font-size: 1rem; margin-bottom: 10px; }
.tech-day h2 .avatar { width: 28px; height: 28px; font-size: .7rem; }
.tech-day.unassigned h2 { color: var(--warn); }
.tech-day.unassigned h2 .i { color: var(--warn); }
.tech-day .hint { margin-top: -4px; }

/* ---------- Calendar ---------- */
.calbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.calbar h1 { margin: 0 6px; font-size: 1.3rem; flex: 1 1 auto; }
.pager { display: inline-flex; gap: 4px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--soft); border: 1px solid var(--line); border-radius: 11px; }
.seg a { padding: 0 14px; height: 32px; display: inline-flex; align-items: center; border-radius: 8px; color: var(--mute); font-weight: 600; font-size: .88rem; }
.seg a:hover { color: var(--ink); text-decoration: none; }
.seg a[aria-current="page"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(16, 26, 54, .14); }
.tg-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); margin-bottom: 12px; box-shadow: var(--sh-1); }
.tg { --time: 58px; min-width: calc(var(--time) + var(--days) * 120px); }
.tg-head { display: grid; grid-template-columns: var(--time) repeat(var(--days), minmax(0, 1fr)); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 3; }
.tg-day { display: grid; justify-items: center; padding: 8px 0 6px; color: var(--mute); }
.tg-day:hover { text-decoration: none; }
.tg-day small { font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.tg-day b { font-size: 1.3rem; font-weight: 650; color: var(--ink); width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; }
.tg-day:hover b { background: var(--soft); }
.tg-day.is-today small { color: var(--brand-text); }
.tg-day.is-today b { background: var(--brand); color: #fff; }
.tg-body { display: grid; grid-template-columns: var(--time) repeat(var(--days), minmax(0, 1fr)); position: relative; }
.tg-times { position: relative; }
.tg-times span { position: absolute; right: 8px; transform: translateY(-50%); font-size: .7rem; color: var(--mute); white-space: nowrap; }
.tg-times span:first-child { transform: none; }
.tg-col { position: relative; border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent 64px); }
.tg-col.is-today { background-color: color-mix(in srgb, var(--brand-text) 4%, transparent); }
.tg-slot { position: absolute; left: 0; right: 0; height: 64px; z-index: 0; }
/* "+ New job" on an empty hour: computers only (click). On a phone, tapping the calendar never starts a job
   (too easy to hit while scrolling); new jobs come from the + at the top. */
@media (hover: hover) {
  .tg-slot:hover { background: color-mix(in srgb, var(--brand-text) 8%, transparent); }
  .tg-slot:hover::after { content: "+ New job"; position: absolute; left: 6px; top: 4px; font-size: .74rem; color: var(--brand-text); font-weight: 650; }
}
@media (max-width: 699px) { .tg-slot { display: none; } }
.tg-now { position: absolute; left: -1px; right: 0; height: 2px; background: #e5484d; z-index: 2; pointer-events: none; }
.tg-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #e5484d; }
.ev { position: absolute; z-index: 1; margin-left: 3px; padding: 5px 7px; border-radius: 7px; overflow: hidden; text-decoration: none;
  background: color-mix(in srgb, var(--c) 11%, var(--card)); border: 1px solid color-mix(in srgb, var(--c) 22%, transparent); border-left: 3px solid var(--c); color: var(--ink);
  display: flex; flex-direction: column; gap: 1px; font-size: .77rem; line-height: 1.25; }
.ev:hover { z-index: 4; text-decoration: none; box-shadow: var(--sh-2); }
.ev b { font-size: .82rem; }
.ev span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .ev-zip { color: var(--mute); font-size: .7rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.mg-ev small { color: var(--mute); font-size: .68rem; }
.tech-toggles { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.tchip { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2);
  background: var(--card); color: var(--mute); font-size: .84rem; font-weight: 600; }
.tchip:hover { text-decoration: none; border-color: var(--brand-text); }
.tchip .i { width: 15px; height: 15px; }
.tchip.on { background: var(--brand-50); border-color: var(--brand-text); color: var(--brand-text); }
.tchip.none.on { background: var(--warn-50); border-color: var(--warn); color: var(--warn); }
.ev .ev-l { font-weight: 700; color: var(--c); font-size: .76rem; }
.mg { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--card); margin-bottom: 12px; box-shadow: var(--sh-1); }
.mg-dow { padding: 8px 6px; text-align: center; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--mute); border-bottom: 1px solid var(--line); }
.mg-day { min-height: 116px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mg-day:nth-child(7n + 7) { border-right: 0; }
.mg-day.other { background: var(--soft); }
.mg-day.other .mg-num { color: var(--mute); }
.mg-num { align-self: center; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-size: .8rem; font-weight: 650; color: var(--ink); }
.mg-num:hover { background: var(--soft); text-decoration: none; }
.mg-day.is-today .mg-num { background: var(--brand); color: #fff; }
.mg-ev { display: flex; align-items: center; gap: 5px; font-size: .74rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 5px; padding: 2px 4px; }
.mg-ev:hover { background: color-mix(in srgb, var(--c) 13%, transparent); text-decoration: none; }
.mg-ev i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.mg-more { font-size: .74rem; color: var(--mute); padding: 0 4px; }
@media (max-width: 640px) { .mg-day { min-height: 70px; } .mg-ev { font-size: 0; gap: 0; display: inline-flex; } .mg-ev i { width: 7px; height: 7px; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 16px; font-size: .8rem; color: var(--mute); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 6px; vertical-align: -1px; }
.tg-body[data-drag] .ev { cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ev.dragging { cursor: grabbing; z-index: 10; opacity: .95; box-shadow: var(--sh-2); outline: 2px solid var(--brand-text); }
.ev.saving { opacity: .5; }
.tg-body.is-dragging .tg-slot { pointer-events: none; }
.ev, .mg-ev { -webkit-user-drag: none; }
.mg[data-drag] .mg-ev { cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.mg-ev.dragging { position: relative; z-index: 10; pointer-events: none; background: var(--card); box-shadow: var(--sh-2); outline: 2px solid var(--brand-text); cursor: grabbing; }
.mg-day.drop { outline: 2px dashed var(--brand-text); outline-offset: -3px; background: color-mix(in srgb, var(--brand-text) 8%, transparent); }
.tg-day.closed, .mg-day.closed { background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--bad) 7%, transparent) 8px 16px); }
.tg-day em, .mg-off { display: block; font-style: normal; font-size: .68rem; font-weight: 700; color: var(--bad); }
.mg-off { display: inline; margin-left: 4px; }

/* ---------- Job page ---------- */
.job-hero { padding: 22px 22px 18px; }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.eyebrow { margin: 0 0 4px; font-size: .82rem; font-weight: 700; color: var(--mute); letter-spacing: .02em; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.job-hero h1 { margin: 0; font-size: 1.6rem; }
.hero-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.hero-meta { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: .93rem; }
.hero-meta li { display: flex; align-items: center; gap: 7px; color: var(--text); min-width: 0; }
.hero-meta .i { width: 17px; height: 17px; color: var(--mute); }
.hero-meta b { color: var(--ink); }
.seg-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 16px 0 0; padding-bottom: 2px; scrollbar-width: none; }
.seg-tabs a { flex: 0 0 auto; display: grid; gap: 1px; padding: 8px 14px; border-radius: 11px; color: var(--ink); background: var(--soft);
  border: 1px solid var(--line); max-width: 230px; font-size: .9rem; }
.seg-tabs a:hover { text-decoration: none; border-color: var(--line-2); }
.seg-tabs a small { color: var(--mute); font-size: .76rem; }
.seg-tabs a.on { background: var(--brand-50); border-color: var(--brand-text); color: var(--brand-text); box-shadow: inset 0 0 0 1px var(--brand-text); }
.seg-note { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; }
.seg-note .i { width: 16px; height: 16px; }
.actionbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.actionbar form { margin: 0; }
.finished-at { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: var(--ok); margin-right: 6px; }
.paid-top { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-weight: 700; color: var(--ok); padding: 0 6px; }
.job-body { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.col-side .card { padding: 18px; }
.private-notes { border-color: color-mix(in srgb, var(--y) 55%, var(--line)); background: color-mix(in srgb, var(--y) 7%, var(--card)); }
.private-notes form, form.note-form { display: grid; gap: 8px; justify-items: end; }
form.note-form textarea { margin: 0; min-height: 76px; resize: none; overflow: hidden; }
.private-notes textarea { margin: 0; min-height: 76px; resize: none; overflow: hidden; }
.private-notes .hint { margin-bottom: 10px; }
ul.contact { list-style: none; padding: 0; margin: 0 0 4px; display: grid; gap: 8px; font-size: .93rem; }
ul.contact li { display: flex; align-items: center; gap: 9px; min-width: 0; overflow-wrap: anywhere; }
ul.contact .i { width: 17px; height: 17px; color: var(--mute); }
ul.contact b { font-size: 1rem; color: var(--ink); }
.site-head { margin: 16px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.danger { margin: 4px 0 24px; text-align: center; }
ul.visits, ul.texts { list-style: none; padding: 0; margin: 0; }
ul.visits li { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
ul.visits li:last-child, ul.texts li:last-child { border-bottom: 0; }
ul.visits li .btn { grid-column: 2; }
ul.visits li .chip { grid-row: 1; grid-column: 2; justify-self: end; }
ul.visits li > span:first-child { grid-row: 1 / span 2; }
ul.visits li small, ul.texts small { color: var(--mute); }
ul.visits li.off { opacity: .55; }
ul.texts li { padding: 12px 0; border-bottom: 1px solid var(--line); }
ul.texts p { margin: 0 0 4px; color: var(--ink); background: var(--soft); border-radius: 12px 12px 12px 4px; padding: 9px 12px; display: inline-block; max-width: 100%; }
ul.texts small { display: block; font-size: .8rem; }
@media (max-width: 1080px) { .job-body { grid-template-columns: 1fr; } .col-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 16px; } }
@media (max-width: 699px) {
  .job-hero { padding: 18px 16px 16px; }
  .job-hero h1 { font-size: 1.35rem; }
  .hero-meta { flex-direction: column; gap: 8px; }
  /* Buttons stay at the bottom of the screen, above the tab bar */
  body.app main:has(.job-hero .actionbar) { padding-bottom: calc(var(--tab) + 100px + env(safe-area-inset-bottom)); }
  .col-side { display: block; }
}

/* Line items */
.add-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 0 0; }
.quick-row { padding-top: 10px; }
.quick-row .hint { margin: 0 4px 0 0; font-size: .8rem; font-weight: 650; }
.totals-row { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.totals { display: grid; grid-template-columns: auto auto; gap: 4px 28px; margin: 0 0 0 auto; order: 2; font-variant-numeric: tabular-nums; font-size: .93rem; }
.totals dt { color: var(--mute); }
.totals dd { margin: 0; text-align: right; color: var(--ink); }
.totals .grand { font-size: 1.2rem; font-weight: 750; color: var(--ink); }
@media (max-width: 760px) {
  .totals { margin-left: 0; width: 100%; }
  .totals-row button { width: 100%; order: 3; }
}
}

/* Payments */
.balance { font-size: .95rem; color: var(--mute); }
.balance b { color: var(--ink); font-size: 1.2rem; }
.balance.paid { color: var(--ok); font-weight: 700; }
ul.pays { list-style: none; padding: 0; margin: 0 0 14px; }
ul.pays li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
ul.pays li b { color: var(--ink); }
ul.pays small { color: var(--mute); }
ul.pays li.refund b { color: var(--bad); }
ul.pays li form { margin: 0; }
.pay-tools { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
details.refund-one > summary { list-style: none; margin: 0; color: var(--bad); }
details.refund-one > summary::-webkit-details-marker { display: none; }
details.refund-one[open] { flex-basis: 100%; }
.refund-form { margin-top: 10px !important; padding: 12px; border: 1px solid color-mix(in srgb, var(--bad) 30%, var(--line)); border-radius: var(--r-sm); background: var(--bad-50); text-align: left; }
ul.pays li { flex-wrap: wrap; }
details.refund-box { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
details.refund-box summary { color: var(--bad); }

/* Photos */
.photo-add { cursor: pointer; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.photo-grid figure { margin: 0; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; background: var(--soft); border: 1px solid var(--line); }
.photo-grid figcaption { display: flex; justify-content: space-between; align-items: center; gap: 4px; font-size: .74rem; color: var(--mute); margin-top: 6px; }
.photo-grid figcaption form { margin: 0; }

/* Event lists (dashboard, job History): newest on top, scroll for older ones */
ol.events { list-style: none; padding: 0 6px 0 0; margin: 0; max-height: 460px; overflow-y: auto; overscroll-behavior: contain;
  mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); }
ol.events > li { display: grid; grid-template-columns: 30px 76px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
#history ol.events > li { grid-template-columns: 30px 130px 1fr; }
ol.events time { color: var(--mute); font-size: .82rem; font-variant-numeric: tabular-nums; padding-top: 1px; }
ol.events .who { display: block; color: var(--mute); font-size: .8rem; }
.events-note { font-size: .8rem; color: var(--mute); margin: -4px 0 8px; }
ul.diff { margin: 6px 0 0; padding-left: 18px; font-size: .88rem; }
ul.diff li { padding: 2px 0; }
ul.diff s { color: var(--mute); }
.ev-good { color: var(--ok); font-weight: 600; }
.ev-good b { color: var(--ok); }
.ev-bad { color: var(--bad); font-weight: 600; }
.ev-bad b { color: var(--bad); }
@media (max-width: 640px) { #history ol.events > li, ol.events > li { grid-template-columns: 30px 1fr; gap: 2px 10px; } ol.events > li > div { grid-column: 2; } ol.events > li > .ev-ic { grid-row: span 2; } }

/* Dashboard */
.datejump { display: flex; gap: 6px; align-items: center; margin: 0; }
.datejump input { margin: 0; height: 40px; }

/* Reports */
.rtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.rtabs a { height: 34px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--text); background: var(--card); font-size: .88rem; font-weight: 600; }
.rtabs a:hover { text-decoration: none; border-color: var(--brand-text); }
.rtabs a[aria-current="page"] { background: var(--brand); color: #fff; border-color: var(--brand); }
form.range { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
form.range label { margin: 0; }
form.range input { margin-top: 4px; }
.presets { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.presets a { font-size: .82rem; height: 30px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); color: var(--text); }
.presets a:hover { text-decoration: none; background: var(--soft); }
.presets a[aria-current="page"] { border-color: var(--brand-text); color: var(--brand-text); background: var(--brand-50); font-weight: 650; }
.tscroll { overflow-x: auto; }
table.rpt th.num, table.rpt td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.rpt tfoot td { font-weight: 700; color: var(--ink); border-top: 2px solid var(--line-2); }
.report-table .head h2 { margin: 0; }
@media (max-width: 640px) { table.rpt tfoot { display: block; } table.rpt tfoot tr { display: block; } table.rpt tfoot td { display: flex; justify-content: space-between; } table.rpt tfoot td:empty { display: none; } }

/* Settings, users, forms that need a little extra */
form.settings { max-width: 760px; }
form.settings .card h2 { margin-bottom: 16px; }
.savebar { position: sticky; bottom: 16px; z-index: 5; display: flex; justify-content: flex-end; padding: 12px; margin: 0 0 16px;
  background: color-mix(in srgb, var(--card) 92%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-2); }
@media (max-width: 699px) { .savebar { bottom: calc(var(--tab) + 12px + env(safe-area-inset-bottom)); } .savebar button { width: 100%; height: 46px; } }
#backups { max-width: 760px; }
.days-off { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 16px 4px; margin: 4px 0 16px; background: var(--soft); }
.days-off legend { font-weight: 700; color: var(--ink); padding: 0 6px; font-size: .9rem; }
.off-list { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; }
.zip-list { max-height: 220px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; }
.zip-list small, .holiday-list small { color: var(--mute); font-weight: 500; }
.holiday-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; }
.temp-pw { font: 700 1.6rem/1.2 ui-monospace, Menlo, monospace; letter-spacing: .06em; color: var(--ink); background: var(--soft); padding: 14px; border-radius: var(--r-sm); text-align: center; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
form.inline { display: inline; }
details.site { margin: 4px 0 16px; padding: 12px 14px; border: 1px dashed var(--line-2); border-radius: var(--r-sm); }
details.site summary { margin: 0; }
details.site[open] summary { margin-bottom: 10px; }
.job-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.quick form { margin: 0; }

/* Add an email where it's missing */
form.add-email { display: flex; gap: 6px; flex: 1; min-width: 0; margin: 0; }
form.add-email input { margin: 0; height: 32px; padding: 0 10px; font-size: .88rem; min-width: 0; }
.facts dd form.add-email { max-width: 340px; }

/* Openings grid when scheduling a segment or changing an appointment */
.pick-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.pick-layout > .card { margin: 0; }
.pick-layout > form.card { max-width: none; position: sticky; top: 16px; }
@media (max-width: 1099px) { .pick-layout { grid-template-columns: 1fr; } .pick-layout > form.card { position: static; max-width: 560px; } }
.openings .head { margin-bottom: 10px; }
.openings .pager { align-items: center; gap: 6px; }
.openings .wk { font-size: .88rem; font-weight: 650; color: var(--ink); min-width: 120px; text-align: center; }
.og { display: grid; grid-template-columns: 58px repeat(var(--days), minmax(0, 1fr)); gap: 4px; }
.og-day { text-align: center; font-size: .78rem; font-weight: 700; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; padding-bottom: 4px; }
.og-day span { color: var(--ink); }
.og-day.is-today span { color: var(--brand-text); }
.og-day em { display: block; font-style: normal; font-size: .66rem; color: var(--bad); text-transform: none; letter-spacing: 0; }
.og-time { font-size: .72rem; color: var(--mute); text-align: right; padding: 8px 6px 0 0; white-space: nowrap; }
.og-cell { all: unset; box-sizing: border-box; display: grid; align-content: start; gap: 3px; min-height: 48px; padding: 5px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); font-size: .74rem; line-height: 1.2; min-width: 0; }
.og-cell i { font-style: normal; color: var(--ok); font-weight: 650; align-self: center; justify-self: center; margin-top: 10px; }
.og-cell.busy { background: var(--soft); }
.og-cell span { display: block; padding: 2px 5px; border-radius: 5px; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 10%, var(--card));
  color: var(--ink); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.og-cell span small { display: block; font-weight: 500; color: var(--mute); overflow: hidden; text-overflow: ellipsis; }
.og-cell span .og-tech { display: block; font-style: normal; font-weight: 650; font-size: .72rem; color: var(--brand-text); overflow: hidden; text-overflow: ellipsis; }
.og-cell:hover:not([disabled]) { border-color: var(--brand-text); }
.og-cell:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 1px; }
.og-cell.picked { border-color: var(--brand-text); box-shadow: inset 0 0 0 2px var(--brand-text); background: var(--brand-50); }
.og-cell.picked i { color: var(--brand-text); }
.og-cell.picked i::before { content: '✓ '; }
.og-cell.past { opacity: .45; cursor: default; }
.og-day.closed, .og-cell.closed { background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--bad) 6%, transparent) 6px 12px); }
@media (max-width: 699px) { .og { grid-template-columns: 40px repeat(var(--days), minmax(0, 1fr)); gap: 3px; } .og-time { font-size: .64rem; padding-right: 2px; }
  .og-cell { padding: 3px; font-size: .66rem; min-height: 42px; } .og-cell span small { display: none; } .og-cell i { font-size: .66rem; } }

/* Parts on order */
.parts-list { display: grid; gap: 10px; }
.part-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 16px; align-items: start; margin: 0; border-left: 4px solid var(--line-2); }
.part-row.late { border-left-color: var(--bad); }
.part-row.here { border-left-color: var(--ok); }
.part-when { display: grid; gap: 2px; font-size: .9rem; }
.part-when b { color: var(--ink); }
.part-when span { color: var(--mute); font-size: .84rem; }
.part-when em { font-style: normal; font-weight: 700; color: var(--bad); font-size: .8rem; }
.part-main { display: grid; gap: 4px; min-width: 0; }
.part-main small { color: var(--mute); }
.part-main ul { margin: 4px 0; padding-left: 18px; }
.part-main code, .part-status code { font: 600 .82rem ui-monospace, Menlo, monospace; background: var(--soft); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.part-note { display: flex; gap: 6px; max-width: 360px; margin: 4px 0 0; }
.part-note input { margin: 0; height: 32px; font-size: .86rem; }
.part-act { display: flex; gap: 8px; align-items: center; margin: 0; }
.part-act .arrived { display: inline-flex; gap: 5px; align-items: center; color: var(--ok); font-weight: 650; font-size: .88rem; white-space: nowrap; }
.part-act .arrived .i { width: 16px; height: 16px; }
@media (max-width: 699px) { .part-row { grid-template-columns: 1fr; gap: 8px; } }
.parts-tile.late { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.parts-tile small strong { color: var(--bad); }
.part-status { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--warn-50); color: var(--warn); font-weight: 600; font-size: .9rem; }
.part-status.here { background: var(--ok-50); color: var(--ok); }
.part-status .i { width: 17px; height: 17px; }
.part-status span { flex: 1; }

/* Notifications (My account) */
ol.steps { margin: 4px 0 12px; padding-left: 20px; display: grid; gap: 4px; }
.push-on { display: flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 650; margin: 0 0 12px; }
.push-on .i { width: 18px; height: 18px; }
[data-push] .actions form { margin: 0; }

/* Text invoice */
.hint code { font: 600 .8rem ui-monospace, Menlo, monospace; background: var(--soft); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; color: var(--ink); }
.send-text { display: flex; gap: 10px; align-items: center; }
.text-invoice .to { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; color: var(--text); }
.text-invoice .to .i { color: var(--mute); width: 18px; height: 18px; }
.text-invoice textarea { min-height: 90px; resize: none; overflow: hidden; }
.link-chip { display: flex; align-items: center; gap: 10px; margin: -4px 0 10px; padding: 10px 14px; border-radius: var(--r-sm);
  background: var(--brand-50); color: var(--brand-text); border: 1px dashed color-mix(in srgb, var(--brand-text) 45%, transparent); font-size: .9rem; }
.link-chip b { color: var(--brand-text); }

/* ---------- Inbox ---------- */
.nav a, .tabbar > a { position: relative; }
.badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: #e5484d; color: #fff;
  font: 700 .72rem/20px inherit; font-style: normal; text-align: center; }
.tabbar .badge { position: absolute; top: 6px; left: calc(50% + 4px); margin: 0; min-width: 18px; height: 18px; line-height: 18px; font-size: .66rem; }
@media (min-width: 700px) and (max-width: 1099px) { .side .badge { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; line-height: 18px; font-size: .66rem; } }
.inbox { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; height: calc(100vh - 100px); min-height: 520px; }
.inbox > .card { margin: 0; display: flex; flex-direction: column; min-height: 0; }
.inbox-list { padding: 18px 12px 8px; }
.inbox-list .head { padding: 0 6px; margin-bottom: 12px; }
.inbox-list .head h1 { font-size: 1.35rem; }
.inbox-list .seg { margin: 0 6px 10px; align-self: flex-start; }
.inbox-off { display: flex; gap: 8px; align-items: flex-start; margin: 0 6px 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--warn-50); color: var(--warn); font-size: .82rem; }
.inbox-off .i { width: 17px; height: 17px; margin-top: 1px; }
ul.convos { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
ul.convos a { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; color: var(--text); }
ul.convos a:hover { background: var(--soft); text-decoration: none; }
ul.convos a[aria-current="page"] { background: var(--brand-50); }
ul.convos .avatar { width: 40px; height: 40px; font-size: .82rem; }
ul.convos .avatar.unknown { background: var(--soft); color: var(--mute); border: 1px solid var(--line); }
ul.convos .avatar .i { width: 18px; height: 18px; }
.convo-main { display: grid; min-width: 0; }
.convo-main b { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-last { display: flex; align-items: center; gap: 5px; font-size: .85rem; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-last .i { width: 14px; height: 14px; }
.convo-side { display: grid; justify-items: end; gap: 4px; font-size: .75rem; color: var(--mute); }
ul.convos a.unread b, ul.convos a.unread .convo-last { color: var(--ink); font-weight: 700; }
ul.convos a.unread time { color: var(--brand-text); font-weight: 700; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand-text); }
.inbox-thread { padding: 0; overflow: hidden; }
.inbox-thread > .empty { margin: auto; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.thread-head > div:first-of-type { display: grid; flex: 1; min-width: 160px; }
.thread-head b { color: var(--ink); font-size: 1.05rem; }
.thread-head small { color: var(--mute); }
.thread-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.thread-head .back { display: none; }
ol.msgs { list-style: none; margin: 0; padding: 18px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; background: var(--soft); }
ol.msgs li { max-width: 72%; display: grid; gap: 3px; }
ol.msgs li p { margin: 0; padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
ol.msgs li small { font-size: .72rem; color: var(--mute); padding: 0 6px; }
ol.msgs li.in { align-self: flex-start; }
ol.msgs li.in p { background: var(--card); border: 1px solid var(--line); color: var(--ink); border-bottom-left-radius: 5px; }
ol.msgs li.out { align-self: flex-end; justify-items: end; }
ol.msgs li.out p { background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
ol.msgs li.call { align-self: center; justify-items: center; text-align: center; max-width: 85%; }
.call-tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-size: .82rem; font-weight: 600; color: var(--text); }
.call-tag .i { width: 15px; height: 15px; }
ol.msgs li.call.missed .call-tag { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); background: var(--bad-50); }
ol.msgs li.call p { background: var(--card); border: 1px dashed var(--line-2); font-size: .9rem; color: var(--text); }
form.reply { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line); background: var(--card); }
form.reply textarea { margin: 0; min-height: 44px; max-height: 160px; resize: none; border-radius: 22px; padding: 11px 16px; overflow-y: auto; }
form.reply button { height: 44px; border-radius: 22px; padding: 0 18px; }
@media (max-width: 1099px) { .inbox { grid-template-columns: 300px minmax(0, 1fr); } }
@media (max-width: 860px) {
  .inbox { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .inbox.has-thread .inbox-list, .inbox:not(.has-thread) .inbox-thread { display: none; }
  .inbox-thread { height: calc(100vh - 120px); }
  .thread-head .back { display: inline-flex; }
}
@media (max-width: 699px) {
  .inbox-thread { height: calc(100dvh - var(--tab) - 110px - env(safe-area-inset-bottom)); }
  .inbox.has-thread { margin: -18px -16px 0; }
  .inbox.has-thread .inbox-thread { border-radius: 0; border-left: 0; border-right: 0; height: calc(100dvh - var(--tab) - 54px - env(safe-area-inset-bottom) - env(safe-area-inset-top)); }
  ol.msgs li { max-width: 85%; }
  .thread-tools .btn { padding: 0 9px; }
}

@media print {
  .no-print, .side, .topbar, .tabbar, .flash, .inv-toolbar { display: none !important; }
  body.app main { margin: 0; }
}

/* ---------- Invoice ---------- */
.sendbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.sendbar form { display: flex; gap: 8px; align-items: center; margin: 0; }
.sendbar form.email input { margin: 0; min-width: 220px; }
.sendbar .hint { flex-basis: 100%; margin: 0; word-break: break-all; }
.inv-frame { background: #e9edf6; border-radius: var(--r); padding: 24px 12px; }
.invoice { color-scheme: light; --ink: #0d1a45; --text: #2c3656; --mute: #646d87; --line: rgba(13,26,69,.14);
  background: #fff; color: var(--text); max-width: 800px; margin: 0 auto; padding: 40px; border-radius: 8px; box-shadow: 0 6px 30px rgba(13,26,69,.12); }
.invoice h1, .invoice h2, .invoice b { color: var(--ink); }
.inv-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 4px solid #fde000; }
.inv-brand { display: flex; gap: 14px; align-items: flex-start; }
.inv-brand div, .inv-meta, .inv-parties div { display: flex; flex-direction: column; gap: 2px; }
.inv-brand b { font-size: 1.35rem; color: #243e90; }
.inv-meta { text-align: right; align-items: flex-end; }
.inv-meta h1 { margin: 0 0 4px; font-size: 1.8rem; letter-spacing: .02em; color: #243e90; }
.inv-state { margin-top: 6px; font-weight: 700; padding: 4px 12px; border-radius: 99px; }
.inv-state.paid { background: #dcfce7; color: #15803d; }
.inv-state.due { background: #fff4d6; color: #9a6700; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 20px 0; }
.inv-parties h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); margin: 0 0 6px; }
.inv-notes { padding: 12px 16px; background: #f3f5fb; border-radius: 8px; margin-bottom: 16px; }
.inv-notes p { margin: 4px 0; }
.inv-lines { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.inv-lines th:first-child { color: var(--ink); font-size: .85rem; }
.inv-lines th.num, .inv-lines td.num { width: 104px; }
.inv-lines .m-line { display: none; }
@media (max-width: 640px) {
  .inv-lines th.num, .inv-lines td.num { width: auto; }
  /* Phones: just the name and amount; qty, price and tax go on a small line under the name. */
  .inv-lines .d { display: none; }
  .inv-lines .m-line { display: block; color: var(--mute); margin-top: 2px; }
  .inv-lines td { overflow-wrap: anywhere; }
}
.inv-empty { color: var(--mute); }
.inv-lines th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); border-bottom: 2px solid var(--ink); padding: 8px 6px; }
.inv-lines td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.inv-lines td small { display: block; color: var(--mute); white-space: pre-line; }
.inv-lines .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv-totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 32px; margin: 0 0 0 auto; max-width: 360px; font-variant-numeric: tabular-nums; }
.inv-totals dt { color: var(--mute); }
.inv-totals dd { margin: 0; text-align: right; }
.inv-totals .grand { font-weight: 700; color: var(--ink); font-size: 1.1rem; border-top: 1px solid var(--line); padding-top: 6px; }
.inv-foot { text-align: center; margin: 32px 0 0; color: var(--mute); }
body.inv-page { background: #e9edf6; padding: 16px 12px 40px; color-scheme: light; }
.inv-toolbar { max-width: 800px; margin: 0 auto 12px; text-align: right; }
@media (max-width: 640px) {
  .invoice { padding: 20px 16px; }
  .inv-meta { text-align: left; align-items: flex-start; }
  .inv-parties { grid-template-columns: 1fr; gap: 12px; }
}
@media print {
  .no-print, .top, .nav, .flash, .inv-toolbar { display: none !important; }
  body, body.inv-page, .inv-frame { background: #fff !important; padding: 0 !important; }
  main { padding: 0; max-width: none; }
  .invoice { box-shadow: none; padding: 0; max-width: none; }
}

.sendbar button { white-space: nowrap; }
/* ---------- Public booking page: one question per screen, clean and white ---------- */
body.book-page { --bg: #f4f5f7; --card: #fff; --ink: #111827; --text: #374151; --mute: #6b7280; --line: #e5e7eb; --blue-2: #243e90;
  color-scheme: light; background: #f4f5f7; color: #374151; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.bk-wrap { max-width: 520px; margin: 0 auto; padding: 24px 16px 40px; }
.bk-card { background: #fff; border-radius: 14px; box-shadow: 0 1px 3px rgba(17,24,39,.08), 0 8px 24px rgba(17,24,39,.06); overflow: hidden; }
.bk-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; }
.bk-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #111827; font-weight: 700; }
.bk-count { font-size: .8rem; color: #6b7280; }
.bk-progress { height: 4px; background: #eef0f4; }
.bk-progress i { display: block; height: 100%; width: 0; background: #243e90; transition: width .25s ease; }
.bookform { padding: 8px 20px 20px; }
.bk-step h1 { font-size: 1.35rem; color: #111827; margin: 18px 0 6px; font-weight: 700; }
.bk-sub { color: #6b7280; margin: 0 0 16px; font-size: .95rem; }
.bk-field { display: block; margin: 0 0 14px; font-weight: 400; }
.bk-field > span { display: block; font-size: .85rem; font-weight: 600; color: #374151; margin-bottom: 6px; }
.bk-field em { font-style: normal; font-weight: 400; color: #9ca3af; margin-left: 4px; }
.bk-field input, .bk-field select, .bk-field textarea { margin: 0; width: 100%; padding: 12px 14px; border: 1px solid #d1d5db; border-radius: 10px;
  background: #fff; color: #111827; font: inherit; }
.bk-field input:focus, .bk-field select:focus, .bk-field textarea:focus { outline: none; border-color: #243e90; box-shadow: 0 0 0 3px rgba(36,62,144,.15); }
.bk-options { display: grid; gap: 8px; }
.bk-opt { position: relative; display: flex; align-items: center; justify-content: space-between; margin: 0; padding: 14px 16px;
  border: 1px solid #e5e7eb; border-radius: 10px; cursor: pointer; font-weight: 500; color: #111827; background: #fff; transition: border-color .15s, background .15s; }
.bk-opt:hover { border-color: #c7cdd9; background: #fafbfc; }
.bk-opt input { position: absolute; opacity: 0; pointer-events: none; }
.bk-opt i { font-style: normal; color: #9ca3af; font-size: 1.3rem; line-height: 1; }
.bk-opt:has(input:checked) { border-color: #243e90; background: #f1f4fb; box-shadow: inset 0 0 0 1px #243e90; }
.bk-opt:has(input:checked) i { color: #243e90; }
.bk-opt:has(input:focus-visible) { outline: 3px solid rgba(36,62,144,.3); outline-offset: 2px; }
.bk-days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px 6px; scrollbar-width: none; }
.bk-day { flex: none; display: grid; justify-items: center; gap: 0; width: 60px; padding: 8px 0; border: 1px solid #e5e7eb; border-radius: 10px;
  background: #fff; color: #374151; font: inherit; cursor: pointer; }
.bk-day small { font-size: .72rem; color: #6b7280; }
.bk-day b { font-size: 1.15rem; color: #111827; }
.bk-day:hover { border-color: #c7cdd9; background: #fafbfc; }
.bk-day[aria-pressed="true"] { background: #243e90; border-color: #243e90; }
.bk-day[aria-pressed="true"] small, .bk-day[aria-pressed="true"] b { color: #fff; }
.bk-dayname { font-size: .85rem; font-weight: 600; color: #374151; margin: 4px 0 8px; }
.bk-review { display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px; margin: 8px 0 16px; padding: 14px 16px; background: #f9fafb; border-radius: 10px; }
.bk-review dt { color: #6b7280; font-size: .88rem; }
.bk-review dd { margin: 0; color: #111827; font-weight: 500; }
.bk-note { font-size: .85rem; color: #6b7280; background: #f9fafb; border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; }
.bk-error { margin: 12px 20px 0; padding: 10px 14px; border-radius: 10px; background: #fef2f2; color: #b91c1c; font-weight: 500; font-size: .92rem; }
.book-zip-out { color: #b91c1c; font-size: .92rem; margin: -4px 0 10px; }
.bk-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; }
.bk-back { background: none; color: #374151; padding: 12px 6px; font-weight: 600; }
.bk-back:hover { background: none; color: #111827; text-decoration: underline; }
.bk-next, .bk-book { background: #243e90; color: #fff; border-radius: 10px; padding: 13px 26px; font-weight: 600; font-size: 1rem; }
.bk-next:hover, .bk-book:hover { background: #1d3277; }
.bk-next:disabled { background: #c7cdd9; cursor: not-allowed; }
.bk-book { width: 100%; padding: 15px; }
.bk-help { text-align: center; color: #6b7280; font-size: .9rem; margin: 18px 0 0; }
.bk-help a, .bk-sub a, .book-zip-out a { color: #243e90; }
.bookform .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.bk-done { padding: 8px 20px 24px; text-align: center; }
.bk-done h1 { font-size: 1.4rem; color: #111827; margin: 8px 0; }
.bk-check { width: 56px; height: 56px; margin: 18px auto 4px; border-radius: 50%; display: grid; place-items: center; background: #e8f5ee; color: #15803d; font-size: 1.8rem; font-weight: 700; }
.bk-when { color: #374151; margin: 0 0 16px; }
.bk-when b { color: #111827; font-size: 1.1rem; }
.bk-done .bk-review { text-align: left; }
/* Step by step (JavaScript on): one screen at a time */
.bookform.wiz .bk-step[hidden] { display: none; }
.bookform:not(.wiz) .bk-nav { display: none; }
.bookform:not(.wiz) .bk-step + .bk-step { border-top: 1px solid #e5e7eb; margin-top: 18px; }

/* Booking: phone note and Google address suggestions */
.bk-fieldnote { font-size: .85rem; color: #b91c1c; margin: -8px 0 12px; }
.bk-fieldnote:not(.bad)[data-addr-note] { color: #15803d; }
.bk-addr { position: relative; }
.bk-suggest { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% - 10px); margin: 0; padding: 4px; list-style: none;
  background: #fff; border: 1px solid #d1d5db; border-radius: 10px; box-shadow: 0 10px 24px rgba(17,24,39,.12); }
.bk-suggest li { display: grid; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.bk-suggest li b { color: #111827; font-weight: 600; }
.bk-suggest li small { color: #6b7280; font-size: .82rem; }
.bk-suggest li:hover, .bk-suggest li[aria-selected="true"] { background: #f1f4fb; }

/* Public pages (booking, customer invoice) keep their own simple light look */
:where(.book-page, .inv-page) button { font: inherit; font-weight: 600; padding: 12px 18px; border: 0; border-radius: 10px; background: #243e90; color: #fff; cursor: pointer; }
:where(.book-page, .inv-page) button:hover { background: #1d3277; }
.book-page .bk-field select { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 18px; padding-right: 36px; }
.book-page .bk-field input, .book-page .bk-field select { height: 46px; }
.book-page a:hover { text-decoration: underline; }

/* Last on purpose: on phones every text box is at least 16px, or iPhone zooms in when you tap it. */
@media (max-width: 760px) {
  body.app input, body.app select, body.app textarea { font-size: 16px !important; }
}

/* ---------- Job page, HCP-style: read-only cards, edit with the pencil ---------- */
.job-hero { padding: 18px 20px; }
.job-hero h1 { margin: 2px 0 0; font-size: 1.5rem; }
.hero-line { margin: 2px 0 0; color: var(--brand-text); font-weight: 650; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
:where(.app) .btn.pill, .pills .btn.pay-top { height: 36px; padding: 0 14px; border-radius: 99px; font-size: .9rem; background: var(--brand-50); color: var(--brand-text); border: 0; }
:where(.app) .btn.pill:hover { background: color-mix(in srgb, var(--brand-text) 16%, var(--card)); }
:where(.app) .btn.pill .i, .pills .btn.pay-top .i { width: 17px; height: 17px; color: currentColor; }
.pills .btn.pay-top { background: var(--ok-50); color: var(--ok); margin: 0; }
.pills .btn.pay-top:hover { background: color-mix(in srgb, var(--ok) 18%, var(--card)); }
.pills .paid-top { margin: 0; height: 36px; padding: 0 12px; border-radius: 99px; background: var(--ok-50); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--brand-text); flex: none; }
.icon-btn:hover { background: var(--brand-50); text-decoration: none; }
.icon-btn .i { width: 20px; height: 20px; }
.icon-btn .save-word { font-weight: 700; font-size: .85rem; }
.items-card.editing [data-edit-items].icon-btn { width: auto; padding: 0 14px; border-radius: 99px; background: var(--brand); color: #fff; }
label.icon-btn { cursor: pointer; margin: 0; }

/* Status card with the big round buttons */
.action-card.actionbar { display: block; margin: 0 0 16px; padding: 16px 20px 18px; border-top: 1px solid var(--line); }

/* Line items: read-only list until the pencil */
.items-card .li-edit { display: none; }
.items-card.editing .li-edit { display: block; }
.items-card.editing .li-read { display: none; }
.li-edit > .card { border: 0; padding: 0; margin: 0; box-shadow: none; background: none; }
.li-edit > .card > .head { display: none; }
.li-group { margin: 14px 0 4px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
ul.li-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
ul.li-list li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
ul.li-list li > div { display: grid; gap: 2px; min-width: 0; }
ul.li-list b { color: var(--ink); font-weight: 600; }
ul.li-list small { color: var(--mute); font-size: .82rem; }
ul.li-list small.on-cal { color: var(--brand-text); font-weight: 650; font-size: .72rem; }
.li-desc { margin: 2px 0 0; color: var(--mute); font-size: .86rem; white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.li-amt { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
dl.li-totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 12px 0 0; font-variant-numeric: tabular-nums; }
dl.li-totals dt { color: var(--mute); }
dl.li-totals dd { margin: 0; text-align: right; color: var(--ink); }
dl.li-totals .grand { font-weight: 750; font-size: 1.05rem; color: var(--ink); }

/* Payments: the form opens from Take payment (or the Pay pill) */
details.take-pay > summary { list-style: none; width: 100%; margin: 4px 0 0; }
details.take-pay > summary::-webkit-details-marker { display: none; }
details.take-pay[open] > summary { display: none; }

/* Photos: a big tap target when there are none */
.dropzone { display: grid; justify-items: center; gap: 4px; padding: 26px 16px; border: 2px dashed var(--line-2); border-radius: var(--r);
  background: var(--soft); color: var(--brand-text); cursor: pointer; text-align: center; font-weight: 600; margin: 0; }
.dropzone .i { width: 30px; height: 30px; }
.dropzone small { color: var(--mute); font-weight: 500; }
.dropzone:hover { border-color: var(--brand-text); }

/* Customer card: name, call / text / map on the right */
.cust-card .c-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); min-height: 48px; overflow-wrap: anywhere; }
.cust-card .c-row.sub { min-height: 0; padding-top: 0; color: var(--mute); font-size: .9rem; border-bottom: 1px solid var(--line); margin-top: -6px; }
.cust-card .c-row b { font-size: 1.02rem; color: var(--ink); }
.cust-card .row-icons { display: flex; gap: 2px; }
.cust-card .link-row { color: var(--ink); justify-content: flex-start; border-bottom: 0; }
.cust-card .link-row:hover { text-decoration: none; background: var(--soft); }
.cust-card .link-row .i { width: 18px; height: 18px; color: var(--mute); }
.cust-card .link-row small { margin-left: auto; color: var(--mute); font-weight: 600; }
.cust-card .link-row .chev, .fold .chev { width: 16px; height: 16px; color: var(--mute); }
.cust-card .site-head { margin-top: 14px; }

/* Texts and History fold into rows */
details.fold { padding: 0; }
details.fold > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 16px 20px; cursor: pointer; margin: 0; color: var(--ink); font-weight: 600; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary .i { width: 19px; height: 19px; color: var(--mute); }
details.fold > summary small { margin-left: auto; color: var(--mute); font-weight: 600; }
details.fold[open] > summary .chev { transform: rotate(90deg); }
details.fold .fold-body { padding: 0 20px 16px; }
ul.visits li .icon-btn { grid-column: 2; justify-self: end; }

/* Phones: one column in HCP's order */
@media (max-width: 1080px) {
  .job-body { display: flex; flex-direction: column; }
  .job-body > .col-main, .job-body > .col-side { display: contents; }
  .job-body .cust-card { order: 1; } .job-body #visits { order: 2; } .job-body #appliance { order: 3; } .job-body #diagnosis { order: 4; }
  .job-body #items { order: 5; } .job-body #payments { order: 6; } .job-body #notes { order: 7; } .job-body #photos { order: 8; }
  .job-body .col-side > section:not(.cust-card):not(#visits):not(#appliance):not(#notes):not(#diagnosis) { order: 9; }
  .job-body details.fold { order: 10; } .job-body .danger { order: 11; }
}
@media (max-width: 699px) {
  .job-hero { padding: 16px; }
  .job-hero h1 { font-size: 1.35rem; }
  .action-card.actionbar { padding: 14px 16px 16px; }
}

.cust-card .c-name { display: grid; gap: 1px; }
.cust-card .c-name small { color: var(--mute); font-size: .88rem; }
.chip-btn.ok-chip { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line-2)); background: var(--ok-50); }
.chip-btn.warn-chip { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line-2)); background: var(--warn-50); }
.chip-btn.ok-chip:hover, .chip-btn.warn-chip:hover { filter: brightness(.97); }
@media (max-width: 1080px) { .job-body { align-items: stretch; } }
@media (max-width: 699px) {
  .pills .pay-word { display: none; }
  .pills .btn.pay-top b::before { content: 'Pay '; font-weight: 600; }
}

/* Computer: line items are always the editor; nothing to tap open */
@media (min-width: 1081px) {
  .items-card .li-edit { display: block; }
  .items-card .li-read, .items-card [data-edit-items] { display: none; }
  details.take-pay > summary { display: none; }
}
.items-card:not(.editing) .li-read { cursor: pointer; }

/* Map pin menu (Open Maps / Open Maps & send On my way) */
dialog.sheet-menu { border: 0; padding: 18px 16px calc(14px + env(safe-area-inset-bottom)); width: min(440px, 100%); max-width: 100%; margin: auto auto 0; border-radius: 18px 18px 0 0;
  background: var(--card); box-shadow: var(--sh-2); display: none; }
dialog.sheet-menu[open] { display: grid; gap: 10px; }
dialog.sheet-menu::backdrop { background: rgba(16, 26, 54, .35); }
dialog.sheet-menu .sheet-title { display: flex; gap: 8px; align-items: flex-start; margin: 0 4px 4px; color: var(--ink); font-weight: 600; }
dialog.sheet-menu .sheet-title .i { color: var(--brand-text); margin-top: 2px; }
dialog.sheet-menu .btn, dialog.sheet-menu button.big { width: 100%; }
dialog.sheet-menu button.link { justify-self: center; padding: 8px; color: var(--mute); }
@media (min-width: 700px) { dialog.sheet-menu { margin: auto; border-radius: 18px; } }

/* Invoice sent, next to Finished */

/* ---------- Line items pages on a phone (list + one item), like Housecall Pro ---------- */
.lp-head { display: grid; grid-template-columns: 80px 1fr 80px; align-items: center; margin: -4px 0 8px; }
.lp-head h1 { margin: 0; text-align: center; font-size: 1.15rem; }
.lp-head a, .lp-head button.link { font-weight: 600; color: var(--brand-text); justify-self: start; }
.lp-head > :last-child { justify-self: end; }
.lp-job { margin: 0 0 10px; text-align: center; }
.lp-group { margin: 16px 4px 6px; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
ul.lp-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
ul.lp-list > li { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); background: var(--card); position: relative; touch-action: pan-y; }
ul.lp-list > li:last-child { border-bottom: 0; }
ul.lp-list > li.dragging { z-index: 5; box-shadow: var(--sh-2); opacity: .97; }
ul.lp-list form { margin: 0; display: flex; }
.lp-del { all: unset; display: grid; place-items: center; width: 46px; cursor: pointer; }
.lp-del i { width: 22px; height: 22px; border-radius: 50%; background: #e5484d; position: relative; }
.lp-del i::after { content: ''; position: absolute; left: 6px; right: 6px; top: 10px; height: 2px; background: #fff; border-radius: 2px; }
.lp-main { flex: 1; display: flex; align-items: center; gap: 8px; padding: 12px 4px 12px 0; color: var(--ink); min-width: 0; }
.lp-main:hover { text-decoration: none; }
.lp-main > span:first-child { flex: 1; display: grid; gap: 2px; min-width: 0; }
.lp-main b { font-weight: 600; font-size: 1.02rem; overflow-wrap: anywhere; }
.lp-main small { color: var(--mute); font-size: .86rem; }
.lp-main small.on-cal { color: var(--brand-text); font-weight: 650; font-size: .72rem; }
.lp-amt { color: var(--mute); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lp-main .chev, .lp-add .chev { width: 16px; height: 16px; color: var(--line-2); flex: none; }
.lp-drag { display: grid; place-items: center; width: 48px; border-left: 1px solid var(--line); color: var(--mute); font-size: 1.4rem; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.lp-add form { flex: 1; }
.lp-add button { all: unset; flex: 1; display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 12px; color: var(--mute); cursor: pointer; }
.lp-add button span { flex: 1; }
.lp-add i.plus { width: 22px; height: 22px; border-radius: 50%; background: #30a46c; position: relative; flex: none; }
.lp-add i.plus::before, .lp-add i.plus::after { content: ''; position: absolute; background: #fff; border-radius: 2px; }
.lp-add i.plus::before { left: 6px; right: 6px; top: 10px; height: 2px; }
.lp-add i.plus::after { top: 6px; bottom: 6px; left: 10px; width: 2px; }
.lp-quick form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 2px 0; }
.lp-quick .hint { margin: 0 4px 0 0; font-size: .8rem; }
dl.lp-totals { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 18px 0 0; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); font-variant-numeric: tabular-nums; }
dl.lp-totals dt { color: var(--text); }
dl.lp-totals dd { margin: 0; text-align: right; color: var(--mute); }
dl.lp-totals .grand { font-weight: 750; color: var(--ink); font-size: 1.05rem; }
.lp-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin: 0 0 14px; overflow: hidden; }
.lp-card > input, .lp-card > textarea { margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; height: auto; padding: 14px 16px; font-size: 1rem; background: none; box-shadow: none; }
.lp-card > textarea { min-height: 90px; resize: none; overflow: hidden; }
.lp-card > :last-child { border-bottom: 0; }
.lp-card > input:focus, .lp-card > textarea:focus { box-shadow: inset 3px 0 0 var(--brand-text); }
.lp-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 6px 16px; min-height: 52px; border-bottom: 1px solid var(--line); font-weight: 500; color: var(--ink); }
.lp-field input:not([type=checkbox]) { margin: 0; border: 0; text-align: right; width: 140px; height: 40px; padding: 0; font-size: 1rem; background: none; box-shadow: none; }
.lp-field.total b { color: var(--ink); font-variant-numeric: tabular-nums; }
input.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
input.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
input.switch:checked { background: #30a46c; }
input.switch:checked::after { transform: translateX(20px); }
.lp-update { width: 100%; }
.lp-delete { padding: 4px 16px; }
.lp-delete button { padding: 12px 0; }

/* Address suggestions on staff forms (same list as the booking page) */
.addr-wrap { position: relative; }
.addr-wrap .bk-suggest { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% - 14px); margin: 0; padding: 4px; list-style: none;
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-sm); box-shadow: var(--sh-2); }
.addr-wrap .bk-suggest li b { color: var(--ink); }

/* ---------- Calendar colors: each tech has a color (Users page). Solid = scheduled, striped = on the way,
   gray = finished, red outline = finished but the job still owes money. ---------- */
.ev.l-scheduled { background: var(--c); border-color: var(--c); color: #fff; }
.ev.l-enroute { background: repeating-linear-gradient(135deg, var(--c) 0 7px, color-mix(in srgb, var(--c) 62%, #fff) 7px 14px); border-color: var(--c); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
:is(.ev.l-scheduled, .ev.l-enroute) :is(.ev-l, .ev-zip) { color: rgba(255, 255, 255, .92); }
.ev.l-complete { background: #eceef2; border-color: #dadde3; border-left-color: var(--c); color: #4b5563; }
.ev.l-complete .ev-l { color: #6b7280; }
.ev[data-due] { box-shadow: 0 0 0 2px var(--bad); }
.ev[data-due]:hover { box-shadow: 0 0 0 2px var(--bad), var(--sh-2); }
.mg-ev.l-scheduled { background: var(--c); color: #fff; }
.mg-ev.l-enroute { background: repeating-linear-gradient(135deg, var(--c) 0 5px, color-mix(in srgb, var(--c) 62%, #fff) 5px 10px); color: #fff; }
:is(.mg-ev.l-scheduled, .mg-ev.l-enroute) small { color: rgba(255, 255, 255, .85); }
:is(.mg-ev.l-scheduled, .mg-ev.l-enroute) i { background: #fff; }
.mg-ev.l-complete { background: #eceef2; color: #4b5563; }
.mg-ev[data-due] { box-shadow: inset 0 0 0 1.5px var(--bad); }
.mg-ev.l-scheduled:hover, .mg-ev.l-enroute:hover { background: var(--c); filter: brightness(1.08); }
.legend :is(.lg-solid, .lg-omw, .lg-done, .lg-due)::before { --c: var(--brand); }
.legend .lg-omw::before { background: repeating-linear-gradient(135deg, var(--c) 0 3px, color-mix(in srgb, var(--c) 55%, #fff) 3px 6px); }
.legend .lg-done::before { background: #dadde3; }
.legend .lg-due::before { background: #eceef2; box-shadow: inset 0 0 0 2px var(--bad); }
.tdot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.tchip .tdot { margin-right: 1px; }
.tchip:not(.on) .tdot { opacity: .35; }
form.inline.color-pick { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.color-pick select { width: auto; min-width: 96px; padding: 4px 8px; height: 34px; }
.users-table td[data-l="Email"] { word-break: break-all; }
.users-table .row-actions { flex-direction: column; align-items: flex-end; }

/* ---------- Finished: how did it go? ---------- */
.outcome-pick { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); align-items: start; }
.outcome-pick .outcome .big { white-space: normal; height: auto; min-height: 48px; padding-block: 10px; line-height: 1.25; }
.outcome-pick .outcome { display: grid; gap: 10px; margin: 0; }
.outcome-pick .outcome h2 { margin: 0; }
.outcome-pick .outcome .big { width: 100%; justify-content: center; }
.to-schedule .plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.to-schedule .plain-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.to-schedule .plain-list li .btn { margin-left: auto; }
.to-schedule .count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--warn-50); color: var(--warn); font-size: .78rem; margin-left: 6px; }

/* New job: returning customer found while typing */
.cust-match { display: grid; gap: 8px; margin: -4px 0 6px; grid-column: 1 / -1; }
.cust-match .cm-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--brand-50); border: 1px solid color-mix(in srgb, var(--brand-text) 25%, transparent); }
.cust-match .cm-row > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.cust-match .cm-row small { color: var(--mute); }
.cust-match .cm-row.dns { background: var(--bad-50); border-color: var(--bad); }
.cust-match .cm-row.dns b { color: var(--bad); }
.dns-warn span { display: inline; }

/* Customer with texts turned off */
.texts-off { color: var(--bad); font-weight: 650; }
.chip.texts-off { background: var(--bad-50); }

/* ---------- Autosave ---------- */
.autosaving [data-manual-save] { display: none; }
.save-badge { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 14px; z-index: 60; display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 99px; background: var(--card); box-shadow: var(--sh-2); font-size: .82rem; font-weight: 650; color: var(--mute); }
.save-badge[hidden] { display: none; }
.save-badge[data-state="saving"]::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--brand-text); animation: spin .7s linear infinite; }
.save-badge[data-state="saved"] { color: var(--ok); }
.save-badge[data-state="saved"]::before { content: "✓"; font-weight: 800; }
.save-badge[data-state="error"] { color: var(--bad); max-width: min(360px, calc(100vw - 28px)); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .save-badge[data-state="saving"]::before { animation: none; } }
@media (max-width: 699px) { .save-badge { top: calc(14px + env(safe-area-inset-top)); } }

/* ---------- Job steps row (Schedule, On my way, Finished, Invoice, Pay, Segment), like Housecall Pro ---------- */
.job-hero { position: relative; }
.job-hero .hero-edit { position: absolute; top: 16px; right: 16px; }
.steps-card.actionbar { padding: 18px 12px 14px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); position: relative; }
.step { position: relative; display: flex; justify-content: center; min-width: 0; }
/* the line joining the steps */
.step:not(:last-child)::after { content: ""; position: absolute; top: 23px; left: calc(50% + 28px); right: calc(-50% + 28px); height: 2px; background: var(--line); }
.step.done:not(:last-child)::after { background: color-mix(in srgb, var(--brand-text) 45%, var(--line)); }
.step-btn { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 0 2px; min-width: 0; max-width: 100%; color: var(--ink); }
span.step-btn { cursor: default; }
.step form { margin: 0; display: contents; }
.step-btn:hover { text-decoration: none; }
.step-dot { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--card); color: var(--mute); transition: background .15s, transform .1s; }
.step-dot .i { width: 22px; height: 22px; stroke-width: 1.9; }
.step-btn b { font-size: .84rem; font-weight: 700; line-height: 1.2; }
.step-btn small { font-size: .72rem; color: var(--mute); line-height: 1.3; }
.step-btn:active .step-dot { transform: scale(.94); }
.step.done .step-dot { background: var(--brand-text); border-color: var(--brand-text); color: #fff; }
.step.now .step-dot { border-color: var(--brand-text); color: var(--brand-text); background: var(--brand-50); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-text) 14%, transparent); }
.step.now b { color: var(--brand-text); }
.step.go .step-dot { border-color: var(--ok-btn); color: #fff; background: var(--ok-btn); box-shadow: none; }
.step.go b { color: var(--ok); }
.step.todo .step-dot { border-style: dashed; }
.step.todo b { color: var(--mute); font-weight: 600; }
.step.due .step-dot { border-color: var(--bad); color: var(--bad); background: var(--bad-50); }
.step.due b, .step.due .due-amt { color: var(--bad); font-weight: 750; }
.step.add .step-dot { border-color: var(--brand-text); color: var(--brand-text); }
a.step-btn:hover .step-dot, button.step-btn:hover .step-dot { filter: brightness(.97); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-text) 12%, transparent); }
.step-note { display: flex; align-items: center; gap: 8px; margin: 14px 8px 0; padding: 9px 12px; border-radius: var(--r-sm); background: var(--soft); font-size: .88rem; }
.step-note .i { width: 18px; height: 18px; color: var(--brand-text); flex: none; }
.step-note span { flex: 1; min-width: 0; }
.step-note .change-outcome { margin: 0; }
@media (max-width: 699px) {
  .steps-card.actionbar { padding: 14px 4px 10px; }
  .step-dot { width: 42px; height: 42px; }
  .step-dot .i { width: 19px; height: 19px; }
  .step:not(:last-child)::after { top: 20px; left: calc(50% + 24px); right: calc(-50% + 24px); }
  .step-btn b { font-size: .72rem; }
  .step-btn small { font-size: .64rem; }
  .step-btn small .s2 { display: none; }
}

/* Segment tabs with a status pill */
.seg-tabs a { min-width: 128px; }
.seg-tabs .seg-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.seg-tabs a > span:not(.seg-top) { font-weight: 600; font-size: .88rem; }
.seg-pill { font-style: normal; font-size: .68rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.seg-pill.done { background: var(--ok-50); color: var(--ok); }
.seg-pill.on { background: var(--brand-50); color: var(--brand-text); }
.seg-pill.off { background: var(--soft); color: var(--mute); }
.seg-tabs a.on .seg-pill.off { background: var(--card); }

/* ---------- Line items editor: one clean row per line, grouped Services / Materials, labels inside the boxes ---------- */
form.items { container-type: inline-size; }
.li-group-edit { margin-bottom: 6px; }
.li-group-edit .li-group { margin: 6px 0 6px; }
.li-none { margin: 4px 0 8px; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) 84px 116px 96px auto; gap: 10px; align-items: start; padding: 12px; margin: 0 0 8px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.item.is-top { border-color: color-mix(in srgb, var(--brand-text) 40%, var(--line)); background: linear-gradient(180deg, var(--brand-50), var(--card) 60%); }
.li-main { display: grid; gap: 8px; min-width: 0; }
label.fl { position: relative; display: block; margin: 0; padding: 5px 10px 4px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--card); font-weight: 400; transition: border-color .15s, box-shadow .15s; }
label.fl:focus-within { border-color: var(--brand-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-text) 14%, transparent); }
label.fl > span { display: flex; gap: 6px; align-items: center; font-size: .68rem; font-weight: 650; color: var(--mute); line-height: 1.2; }
label.fl > span em { font-style: normal; color: var(--brand-text); }
label.fl input { all: unset; box-sizing: border-box; display: block; width: 100%; height: 24px; font-size: .95rem; color: var(--ink); }
label.fl.name input { font-weight: 650; }
label.fl.qty input, label.fl.price input { text-align: right; font-variant-numeric: tabular-nums; }
label.fl.part { max-width: 260px; }
.item textarea.desc { margin: 0; min-height: 36px; padding: 8px 10px; font-size: .9rem; line-height: 1.4; resize: none; overflow: hidden; border-radius: 9px; }
.li-end { display: grid; justify-items: end; gap: 8px; padding-top: 6px; }
.li-end .amt { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; font-size: 1rem; }
.li-end .tax { display: flex; align-items: center; gap: 6px; margin: 0; font-size: .82rem; color: var(--mute); font-weight: 500; }
.item .move { display: flex; flex-direction: column; gap: 2px; }
:where(.app) .item .move button { all: unset; box-sizing: border-box; display: grid; place-items: center; width: 28px; height: 26px; border-radius: 7px; color: var(--mute); cursor: pointer; }
:where(.app) .item .move button:hover:not([disabled]) { background: var(--soft); color: var(--ink); }
:where(.app) .item .move button.x:hover { background: var(--bad-50); color: var(--bad); }
:where(.app) .item .move button[disabled] { opacity: .3; cursor: default; }
.item .move .i { width: 16px; height: 16px; }
/* hover-only actions on computers; always shown on touch screens */
@media (hover: hover) { .item .move { opacity: .35; transition: opacity .15s; } .item:hover .move, .item:focus-within .move { opacity: 1; } }
:where(.app) .add-line { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px; font-weight: 650; font-size: .88rem; color: var(--brand-text); }
:where(.app) .add-line:hover { background: var(--brand-50); }
.add-line .i { width: 16px; height: 16px; }
.add-row { padding: 2px 0 0; }
.li-foot { margin: 10px 0 0; font-size: .78rem; }
.autosaving .totals-row [data-manual-save] { display: none; }
@container (max-width: 620px) {
  .item { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .li-main { grid-column: 1 / -1; }
  .item .move { grid-row: 1; grid-column: 3; flex-direction: row; align-self: start; justify-self: end; }
  .li-main { grid-row: 1; grid-column: 1 / 3; }
  .li-end { grid-column: 3; padding-top: 4px; }
  label.fl.part { max-width: none; }
}

.step-btn small > span { display: block; }
.step-btn small > span:empty { display: none; }

/* Slim job bar that appears at the top once the job's header scrolls away (like Housecall Pro) */
.job-sticky { position: fixed; top: 0; left: var(--side); right: 0; z-index: 25; display: flex; align-items: center; gap: 10px; padding: 10px 36px;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); box-shadow: var(--sh-1); font-size: .92rem; transform: translateY(-110%); transition: transform .18s ease; }
.job-sticky.show { transform: none; }
.job-sticky span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 600; }
.job-sticky b { color: var(--mute); font-weight: 650; white-space: nowrap; }
.seg-pill.enroute { background: color-mix(in srgb, var(--brand-text) 12%, var(--card)); color: var(--brand-text); }
.job-sticky .sticky-pay { margin-left: auto; font-weight: 750; color: var(--bad); white-space: nowrap; }
@media (max-width: 699px) { .job-sticky { top: 0; left: 0; padding: calc(12px + env(safe-area-inset-top)) 16px 10px; font-size: .86rem; } }
@media print { .job-sticky { display: none; } }
@media (prefers-reduced-motion: reduce) { .job-sticky { transition: none; } }

ol.events .ev-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--soft); color: var(--brand-text); }
ol.events .ev-ic .i { width: 15px; height: 15px; }

/* Back to the calendar, top left of a job */
.job-back { display: inline-grid; place-items: center; width: 40px; height: 40px; margin: -8px 0 6px -8px; border-radius: 10px; color: var(--brand-text); }
.job-back:hover { background: var(--brand-50); }
.job-back .i { width: 24px; height: 24px; stroke-width: 2.2; }
.job-back:hover { text-decoration: none; }
.job-sticky .back-link { display: grid; place-items: center; width: 32px; height: 32px; margin-left: -8px; border-radius: 8px; color: var(--brand-text); }
.job-sticky .back-link:hover { background: var(--brand-50); }
.job-sticky .back-link .i { width: 20px; height: 20px; }
/* Phones: a job shows only the job, like Housecall Pro: no top bar or bottom icons, just Back */
@media (max-width: 699px) {
  body.app:has(.job-hero) .topbar, body.app:has(.job-hero) .tabbar { display: none; }
  body.app main:has(.job-hero) { padding-top: calc(env(safe-area-inset-top) + 22px); padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
  body.app:has(.job-hero) .job-sticky { top: 0; padding-top: calc(12px + env(safe-area-inset-top)); }
  body.app:has(.job-hero) .save-badge { top: calc(14px + env(safe-area-inset-top)); }
  .job-back { margin: -4px 0 4px -8px; }
}

/* Private notes: one entry per note, newest first */
.note-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.note-list li { padding: 10px 12px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--card) 70%, transparent); border: 1px solid var(--line); }
.note-list p { margin: 0 0 4px; white-space: pre-wrap; }
.note-list small { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--mute); font-size: .78rem; }
.note-list small form { margin: 0 0 0 auto; }
.note-list small button.link { font-size: .78rem; color: var(--mute); }
.note-add { display: grid; gap: 8px; }
.note-add textarea { margin: 0; }
.note-add button { justify-self: start; }

/* ---------- Calendar time grid: an hour's height is a setting, taller on phones ---------- */
.tg { --hr: 64px; }
.tg-slot { height: var(--hr); }
.ev .ev-addr, .ev .ev-city, .ev .ev-tech { display: none; }

/* ---------- Phone schedule, like Housecall Pro: header, week strip, day of big solid blocks, drawer ---------- */
.cal-m, .cal-drawer { display: none; }
@media (max-width: 699px) {
  body.app:has(.cal-m) .topbar { display: none; }
  body.app main:has(.cal-m) { padding-top: 0; }
  .cal-m { padding-top: calc(env(safe-area-inset-top) + 10px); }
  .cal-m { display: block; position: sticky; top: 0; z-index: 20; margin: 0 -16px 0; background: var(--card); border-bottom: 1px solid var(--line); }
  .calbar, .tech-toggles, .legend { display: none; }
  .cal-m-top { display: grid; grid-template-columns: 44px 1fr auto 44px; align-items: center; height: 52px; padding: 0 6px; }
  .cal-m-top b { text-align: center; font-size: 1.08rem; color: var(--ink); }
  .cal-m-menu { all: unset; display: grid; place-items: center; width: 44px; height: 44px; color: var(--brand-text); cursor: pointer; }
  .cal-m-menu .i, .cal-m-add .i { width: 26px; height: 26px; stroke-width: 2.1; }
  .cal-m-today { font-weight: 650; color: var(--brand-text); padding: 0 10px; font-size: 1.02rem; }
  .cal-m-add { display: grid; place-items: center; width: 44px; height: 44px; color: var(--brand-text); }
  .cal-m-week { display: grid; grid-template-columns: 22px repeat(7, 1fr) 22px; align-items: center; padding: 2px 0 0; }
  .cal-m-week a { display: grid; justify-items: center; gap: 2px; color: var(--ink); padding: 2px 0; }
  .cal-m-week a:hover { text-decoration: none; }
  .cal-m-week small { font-size: .7rem; color: var(--mute); }
  .cal-m-week b { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-size: 1.12rem; font-weight: 500; }
  .cal-m-week a.other b { color: var(--mute); }
  .cal-m-week a.today b { color: var(--brand-text); font-weight: 700; }
  .cal-m-week a.on b { background: var(--ink); color: #fff; font-weight: 600; }
  .cal-m-week .cal-m-arrow { color: var(--mute); }
  .cal-m-week .cal-m-arrow .i { width: 16px; height: 16px; }
  .cal-m-date { margin: 2px 0 8px; text-align: center; font-size: .95rem; color: var(--ink); }
  /* the day: full width, no card around it, big solid blocks */
  .tg-wrap { border: 0; border-radius: 0; box-shadow: none; background: none; margin: 0 -16px; }
  .tg { --hr: 100px; --time: 50px; min-width: 0; }
  .tg[style*="--days:1"] .tg-head { display: none; }
  .tg-col { border-left: 0; }
  .tg-times span { font-size: .72rem; font-weight: 600; }
  .ev { padding: 6px 9px; gap: 0; font-size: .8rem; line-height: 1.3; border-radius: 4px; margin-left: 0; }
  .ev b { font-size: .86rem; }
  .ev .ev-addr, .ev .ev-city, .ev .ev-tech { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ev .ev-zip { display: none; }
  .ev .ev-l { font-weight: 500; font-size: .8rem; }
  .ev.l-scheduled .ev-l, .ev.l-enroute .ev-l { color: #fff; }
  /* the drawer slides out from the left */
  .cal-drawer[open] { display: block; position: fixed; inset: 0 auto 0 0; width: min(78vw, 320px); height: 100%; max-height: none; margin: 0; padding: calc(14px + env(safe-area-inset-top)) 0 20px; border: 0;
    background: var(--card); box-shadow: var(--sh-2); animation: drawer-in .2s ease-out; overflow-y: auto; }
  .cal-drawer::backdrop { background: rgba(16, 26, 54, .35); }
  .dr-h { margin: 14px 20px 6px; font-size: .8rem; color: var(--mute); font-weight: 600; }
  .dr-row { display: flex; align-items: center; gap: 14px; padding: 13px 20px; color: var(--ink); font-size: 1.05rem; }
  .dr-row:hover { text-decoration: none; background: var(--soft); }
  .dr-row .i { width: 22px; height: 22px; }
  .dr-row.on:not(.dr-check) { background: var(--brand-50); color: var(--brand-text); }
  .dr-box { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 5px; border: 2px solid var(--c); color: #fff; }
  .dr-box .i { width: 16px; height: 16px; stroke-width: 3; opacity: 0; }
  .dr-check.on .dr-box { background: var(--c); }
  .dr-check.on .dr-box .i { opacity: 1; }
}
@keyframes drawer-in { from { transform: translateX(-100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .cal-drawer[open] { animation: none; } }

@media (max-width: 699px) { .tg-body[data-drag] .ev, .mg[data-drag] .mg-ev { cursor: pointer; -webkit-user-select: auto; user-select: auto; -webkit-touch-callout: default; } }

/* ---------- Customers search (like Housecall Pro): one box, results as you type ---------- */
.cs-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.cs-head h1 { margin: 0; font-size: 1.8rem; }
.cs-add .i { width: 24px; height: 24px; }
.cs-search { position: sticky; top: 8px; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 0 14px; margin: 0 0 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-2); }
.cs-search > .i { width: 20px; height: 20px; color: var(--mute); flex: none; }
.cs-search input { all: unset; box-sizing: border-box; flex: 1; min-width: 0; height: 54px; font-size: 1.05rem; color: var(--ink); }
.cs-search input::placeholder { color: var(--mute); }
.cs-search:focus-within { border-color: var(--brand-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-text) 14%, transparent), var(--sh-2); }
.cs-group { margin: 6px 4px 8px; font-size: .76rem; font-weight: 700; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; }
.cs-group small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.cs-list { list-style: none; margin: 0 0 18px; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1); overflow: hidden; }
.cs-list li + li { border-top: 1px solid var(--line); }
.cs-list a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--ink); }
.cs-list a:hover { text-decoration: none; background: var(--soft); }
.cs-list a:active { background: var(--brand-50); }
.cs-av { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--c) 14%, var(--card)); color: var(--c); font-weight: 700; font-size: .9rem; }
.cs-av.job { --c: var(--brand-text); }
.cs-av.job .i { width: 18px; height: 18px; }
.cs-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.cs-main b { font-weight: 650; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-main small { color: var(--mute); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-list .chev { width: 18px; height: 18px; color: var(--line-2); flex: none; }
.cs-list mark { background: color-mix(in srgb, #fde047 55%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.cs-dns { font-style: normal; font-size: .68rem; font-weight: 700; color: var(--bad); background: var(--bad-50); padding: 2px 7px; border-radius: 99px; margin-left: 6px; vertical-align: 2px; }
.cs-tips { padding: 4px 2px; }
.cs-tips > p { margin: 0 0 10px; font-size: .76rem; font-weight: 700; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; }
.cs-tips ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.cs-tips li { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.cs-tips li > .i { width: 20px; height: 20px; color: var(--brand-text); flex: none; }
.cs-tips li b { font-weight: 600; }
@media (max-width: 699px) { .cs-tips ul { grid-template-columns: 1fr; } }
.cs-empty { text-align: center; padding: 40px 16px; color: var(--mute); }
.cs-empty > .i { width: 32px; height: 32px; }
.cs-empty p { margin: 10px 0 16px; }
@media (max-width: 699px) {
  .cs-head h1 { font-size: 1.6rem; }
  .cs-search { top: 4px; }
  .cs-list { margin-inline: -4px; }
}
/* Phones: the Customers page has its own title, so no app top bar (like Schedule and jobs) */
@media (max-width: 699px) {
  body.app:has(.cs-head) .topbar { display: none; }
  body.app main:has(.cs-head) { padding-top: var(--top-gap); }
  .cs-search { top: calc(env(safe-area-inset-top) + 10px); }
}

/* ---------- Settings: a menu of sections (like Housecall Pro), each its own page ---------- */
.set-title { margin: 0 0 14px; }
.set-group { margin: 18px 4px 8px; font-size: .76rem; font-weight: 700; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; }
.set-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1); overflow: hidden; max-width: 760px; }
.set-list li + li { border-top: 1px solid var(--line); }
.set-list a { display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: var(--ink); }
.set-list a:hover { text-decoration: none; background: var(--soft); }
.set-list a > .i:first-child { width: 22px; height: 22px; color: var(--brand-text); flex: none; }
.set-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.set-main b { font-weight: 600; }
.set-main small { color: var(--mute); font-size: .82rem; }
.set-now { font-style: normal; font-size: .78rem; font-weight: 650; color: var(--mute); background: var(--soft); padding: 2px 8px; border-radius: 99px; }
.set-list .chev { width: 18px; height: 18px; color: var(--line-2); flex: none; }
.set-head { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; }
.set-head h1 { margin: 0; }
.set-head .job-back { margin: 0 0 0 -8px; }
form.settings.card, .set-head + section.card { max-width: 760px; }
form.settings.card .actions { margin-top: 16px; }

/* ---------- Phone job page (like Housecall Pro): Invoice / Pay pills, small segment tabs that stay,
   On my way + Finish; payments live on their own Pay page ---------- */
.m-pills, .seg-mini, .act-m { display: none; }
.pill-due { background: var(--bad-50) !important; color: var(--bad) !important; }
.pill-due b { margin-left: 2px; }
@media (max-width: 699px) {
  .action-card.steps-card { display: none; }
  .job-hero .seg-tabs { display: none; }
  .job-body #payments { display: none; }
  .m-pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 0; }
  .m-pills .btn.pill { height: 40px; padding: 0 16px; font-size: .95rem; }
  .seg-mini { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: -6px 0 12px; border-bottom: 1px solid var(--line); }
  .seg-mini a { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 10px 12px 9px; font-size: .9rem; font-weight: 600; color: var(--mute); border-bottom: 2.5px solid transparent; white-space: nowrap; }
  .seg-mini a:hover { text-decoration: none; }
  .seg-mini a.on { color: var(--brand-text); border-bottom-color: var(--brand-text); }
  .seg-mini a i { font-style: normal; font-size: .72rem; font-weight: 600; color: var(--ok); }
  .seg-mini .seg-plus { color: var(--brand-text); margin-left: auto; }
  .seg-mini .seg-plus .i { width: 16px; height: 16px; }
  .job-sticky { flex-wrap: wrap; row-gap: 0; }
  .job-sticky .seg-mini { flex-basis: 100%; margin: 4px -16px -8px; padding: 0 8px; border-bottom: 0; }
  .act-m { display: block; padding: 14px; }
  .act-m-row { display: flex; justify-content: space-around; }
  .act-m form { margin: 0; }
  .act-m-btn { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 110px; color: var(--brand-text); text-align: center; }
  .act-m-btn:hover { text-decoration: none; }
  .act-m-dot { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 50%; border: 2px solid var(--brand-text); }
  .act-m-dot .i { width: 26px; height: 26px; stroke-width: 1.9; }
  .act-m-btn b { font-size: .92rem; }
  .act-m-btn small { font-size: .74rem; color: var(--mute); font-weight: 500; }
  .act-m-btn.done { color: var(--mute); cursor: default; }
  .act-m-btn.done .act-m-dot { background: var(--brand-text); border-color: var(--brand-text); color: #fff; }
  .act-m-btn.go { color: var(--ok); }
  .act-m-btn.go .act-m-dot { background: var(--ok-btn); border-color: var(--ok-btn); color: #fff; }
  .act-m-btn:active .act-m-dot { transform: scale(.95); }
  .act-m-done { display: flex; align-items: center; gap: 12px; color: var(--ink); }
  .act-m-done:hover { text-decoration: none; }
  .act-m-done > .i { width: 24px; height: 24px; color: var(--ok); flex: none; }
  .act-m-done span { flex: 1; display: grid; gap: 2px; }
  .act-m-done small { color: var(--mute); }
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86rem; }
.agent-urls dd code { word-break: break-all; }

/* Test mode: on every page until go-live, so nobody forgets texts and emails are going to the owner */
.test-banner { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 9px 14px; border-radius: var(--r-sm);
  background: #fef3c7; color: #78350f; border: 1px solid #f59e0b; font-size: .9rem; }
.test-banner svg { width: 18px; height: 18px; flex: none; }
.test-banner a { color: inherit; font-weight: 700; margin-left: 4px; }
dialog.move-box label.check { margin: 0 4px 4px; font-weight: 500; }
