/* Omniscient office app — styled after the IW Scheduler dispatch board.
   Tokens first (light + dark), then the shell (rail / topbar / workspace), then the
   four board views (schedule, jobs, search, customers), then everything else. */

:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #63736d;
  --line: #dbe3df;
  --paper: #fbfaf6;
  --green: #14453d;
  --green-soft: #d9eee8;
  --green-dark: #14453d;
  --blue: #2f6fbc;
  --blue-soft: rgba(47, 111, 188, 0.12);
  --amber: #d89222;
  --amber-ink: #9a6410;
  --amber-soft: rgba(216, 146, 34, 0.16);
  --red: #c7523a;
  --red-soft: rgba(199, 82, 58, 0.12);
  --shadow: 0 18px 50px rgba(23, 33, 29, 0.12);
  --surface: #ffffff;
  --panel: var(--surface);
  --card: var(--surface);
  --bg: var(--paper);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --surface-translucent: rgba(255, 255, 255, 0.92);
  --surface-veil: rgba(255, 255, 255, 0.78);
  --tint-1: rgba(23, 33, 29, 0.04);
  --tint-2: rgba(23, 33, 29, 0.09);
  --stripe-b: #fdeea4;
  --stripe-b-border: #f2dc73;
  --notice-bg: #fff6df;
  --notice-ink: #664008;
  --on-green: #ffffff;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e7efec;
  --muted: #97a7a1;
  --line: #2c3a36;
  --paper: #0f1614;
  --green: #4bbfa6;
  --green-soft: rgba(75, 191, 166, 0.16);
  --green-dark: #4bbfa6;
  --blue: #6aa6e8;
  --blue-soft: rgba(106, 166, 232, 0.16);
  --amber: #e0a648;
  --amber-ink: #e0a648;
  --amber-soft: rgba(224, 166, 72, 0.16);
  --red: #e87a63;
  --red-soft: rgba(232, 122, 99, 0.16);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --surface: #18221f;
  --surface-strong: rgba(24, 34, 31, 0.98);
  --surface-translucent: rgba(24, 34, 31, 0.92);
  --surface-veil: rgba(24, 34, 31, 0.78);
  --tint-1: rgba(255, 255, 255, 0.05);
  --tint-2: rgba(255, 255, 255, 0.1);
  --stripe-b: #33301c;
  --stripe-b-border: #4b4529;
  --notice-bg: rgba(224, 166, 72, 0.14);
  --notice-ink: #e8c48a;
  --on-green: #0f1614;
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { background: var(--paper); }
body {
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(20, 69, 61, 0.08), transparent 32%),
    linear-gradient(315deg, rgba(216, 146, 34, 0.12), transparent 28%),
    var(--paper);
  min-height: 100svh;
}
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; color: inherit; }
h1, h2, h3, h4, h5 { line-height: 1.2; }
h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.ic { flex: none; }
.muted { color: var(--muted); }
.mt { margin-top: 12px; }
.mb0 { margin-bottom: 0; }
.r { text-align: right; }
.loading { color: var(--muted); padding: 30px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100svh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 32px; width: 400px; max-width: 100%; }
.login-card h1 { font-size: 22px; color: var(--green); margin-bottom: 4px; font-weight: 900; }
.login-card .sub { color: var(--muted); margin-bottom: 20px; font-size: 13px; }
.login-card h3 { margin: 6px 0 8px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; background: var(--tint-1); border-radius: 10px; padding: 4px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; color: var(--muted); font-weight: 700; }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }
.linkish { background: none; border: 0; padding: 6px 0 0; color: var(--green-dark); font-size: 13px; text-decoration: underline; cursor: pointer; }
.banner-ok { background: var(--green-soft); color: var(--green); border-radius: 10px; padding: 12px 14px; font-weight: 600; margin: 12px 0; }

/* ---------- shell: rail + workspace ---------- */
.app-shell { min-height: 100svh; display: grid; grid-template-columns: 88px 1fr; }
.rail {
  position: sticky; top: 0; height: 100svh; overflow-y: auto; scrollbar-width: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 14px;
  border-right: 1px solid var(--line); background: var(--surface-veil); backdrop-filter: blur(18px);
}
.rail::-webkit-scrollbar { display: none; }
.brand-mark {
  width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 10px; flex: none;
  border-radius: 8px; color: var(--on-green); background: var(--green); font-weight: 850; font-size: 16px; letter-spacing: 0;
}
.brand-mark:hover { text-decoration: none; }
.nav-button {
  width: 60px; min-height: 52px; flex: none; display: grid; place-items: center; gap: 3px;
  border: 0; border-radius: 8px; color: var(--muted); background: transparent; padding: 4px 0;
}
.nav-button:hover { text-decoration: none; color: var(--ink); background: var(--tint-1); }
.nav-button span:last-child { font-size: 10px; line-height: 1; white-space: nowrap; }
.nav-button .ic { width: 20px; height: 20px; }
.nav-button.active { color: var(--green); background: var(--green-soft); }
.nav-icon-wrap { position: relative; display: grid; place-items: center; }
.nav-badge { position: absolute; top: -6px; right: -8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--red); color: #fff; font-size: 10px; font-weight: 900; line-height: 16px; text-align: center; }
.rail :focus-visible { outline-color: var(--green); }

.workspace { width: min(1260px, 100%); margin: 0 auto; padding: 24px 28px 48px; min-width: 0; }
.main { min-width: 0; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.brand-wrap { min-width: 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.brand-title { font-size: 22px; font-weight: 900; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.icon-button {
  width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-veil); color: var(--muted); padding: 0;
}
.icon-button:hover { color: var(--ink); }
.icon-button .ic { width: 20px; height: 20px; }
.topbar-menu { position: relative; }
.topbar-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 220px; max-height: calc(100svh - 90px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; padding: 6px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); box-shadow: var(--shadow);
}
.topbar-dropdown[hidden] { display: none; }
.menu-backdrop { position: fixed; inset: 0; z-index: 55; border: 0; background: transparent; cursor: default; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: 14px; text-align: left; }
.menu-item:hover { background: var(--tint-1); text-decoration: none; }
.menu-item.active { background: var(--green-soft); color: var(--green); }
.menu-item .ic { width: 18px; height: 18px; color: var(--muted); }
.menu-item.active .ic { color: inherit; }
.menu-sep { height: 1px; margin: 4px 2px; background: var(--line); }
.menu-foot { padding: 8px 12px 6px; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-dropdown .nav-only { display: none; }
#coach-btn button { background: var(--amber-soft); color: var(--amber-ink); border: 1px solid transparent; border-radius: 999px; padding: 7px 12px; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
#coach-btn button:hover { border-color: var(--amber); }
.btn.demo-cta { background: #f2c14e; color: #1c2420; }
.coach-mini { display: none; }

.bottom-tabs { display: none; }

/* ---------- buttons ---------- */
.btn, .primary-action, .secondary-action, .danger-action, .wide-action {
  min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 8px; padding: 0 15px; font-weight: 800; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn, .primary-action { color: var(--on-green); background: var(--green); }
.btn:hover, .primary-action:hover { text-decoration: none; filter: brightness(1.08); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn.ghost, .secondary-action { background: var(--panel); color: var(--ink); border: 1px solid var(--line); font-weight: 700; }
.btn.ghost:hover, .secondary-action:hover { border-color: var(--blue); color: var(--blue); filter: none; }
.btn.danger, .danger-action { background: transparent; color: var(--red); border: 1px solid var(--line); }
.btn.danger:hover, .danger-action:hover { background: var(--red-soft); filter: none; }
.wide-action { width: 100%; color: var(--green); background: var(--green-soft); }
.btn:disabled, .primary-action:disabled, .secondary-action:disabled { opacity: 0.55; cursor: default; filter: none; }
.btn .ic, .primary-action .ic, .secondary-action .ic { width: 18px; height: 18px; }

/* ---------- headings / chips / metrics ---------- */
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-heading h2 { margin: 0; }
.sync-note { margin: 4px 0 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; }
.head-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.hero-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.metric { min-height: 62px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-veil); box-shadow: var(--shadow); color: inherit; display: block; }
a.metric:hover { text-decoration: none; border-color: var(--blue); }
.metric span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric strong { display: block; margin-top: 3px; font-size: 26px; line-height: 1; font-weight: 900; }
.metric-sub { color: var(--muted); font-size: 14px; font-weight: 700; }
.metric-won { color: var(--green); }

.filter-chip, .won-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-veil); color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.filter-chip:hover, .won-chip:hover { border-color: var(--blue); color: var(--blue); }
.filter-chip.active { color: var(--on-green); background: var(--green); border-color: var(--green); }
.won-chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.won-chip-n { font-size: 11px; opacity: 0.75; font-weight: 700; }
.filter-chip .ic { width: 14px; height: 14px; }

.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; background: var(--tint-1); color: var(--muted); border: 1px solid transparent; }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.amber { background: var(--amber-soft); color: var(--amber-ink); }
.chip.red { background: var(--red-soft); color: var(--red); }

.status-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-translucent); color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap;
}
.status-chip.status-in_progress { color: var(--blue); border-color: rgba(47, 111, 188, 0.4); background: var(--blue-soft); }
.status-chip.status-completed, .status-chip.status-paid, .status-chip.status-accepted { color: var(--on-green); background: var(--green); border-color: var(--green); }
.status-chip.status-canceled, .status-chip.status-declined, .status-chip.status-void { text-decoration: line-through; }
.status-chip.status-sent, .status-chip.status-viewed { color: var(--blue); border-color: rgba(47, 111, 188, 0.4); }
.status-chip.status-partially_paid { color: var(--amber-ink); border-color: rgba(216, 146, 34, 0.5); background: var(--amber-soft); }

.job-badge { flex-shrink: 0; display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; border: 1px solid transparent; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.job-badge-proposal { color: var(--blue); background: var(--blue-soft); border-color: rgba(47, 111, 188, 0.25); }
.job-badge-job { color: var(--amber-ink); background: var(--amber-soft); border-color: rgba(216, 146, 34, 0.35); }
.job-badge-invoice { color: var(--green); background: var(--green-soft); border-color: rgba(20, 69, 61, 0.2); }
.job-badge-client { color: var(--muted); background: var(--tint-1); border-color: var(--line); }
.job-badge-crew { color: var(--type-ink, #fff); background: var(--type-fill, var(--green)); }
.job-badge-paid { color: var(--on-green); background: var(--green); border-color: var(--green); }
.job-amount { font-size: 14px; font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }

.done-toggle {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-translucent); color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; cursor: pointer;
}
.done-toggle .ic { width: 13px; height: 13px; }
.done-toggle.is-done { color: #fff; background: var(--blue); border-color: var(--blue); cursor: default; }
.done-toggle:hover:not(.is-done) { border-color: var(--blue); color: var(--blue); }

/* ---------- schedule: dispatch board ---------- */
.board-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.board-chips .filter-chip { padding: 6px 12px; font-size: 12.5px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); gap: 20px; align-items: start; }
.schedule-lane { min-width: 0; }
.timeline { display: grid; gap: 12px; }
.day-group { display: grid; gap: 10px; padding: 12px; border-radius: 10px; border: 1px solid transparent; }
.day-group:nth-of-type(even) { background: var(--stripe-b); border-color: var(--stripe-b-border); }
.day-group.is-today { border-color: var(--green); }
.day-heading { position: sticky; top: 0; z-index: 3; margin: -12px -12px 6px; border-radius: 10px 10px 0 0; border-bottom: 1px solid var(--line); background: var(--surface-strong); font-size: inherit; }
.day-group:nth-of-type(even) .day-heading { background: var(--stripe-b); border-bottom-color: var(--stripe-b-border); }
.day-group[data-folded="true"] .day-heading { margin: 0; border-radius: 10px; border-bottom: 0; }
.day-group[data-folded="true"] { padding: 0; }
.day-toggle { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; background: transparent; text-align: left; border-radius: 10px; }
.day-caret { flex: none; color: var(--muted); transition: transform 140ms ease; width: 18px; height: 18px; }
.day-toggle[aria-expanded="false"] .day-caret { transform: rotate(-90deg); }
.day-name { flex: 1 1 auto; min-width: 0; color: var(--ink); font-size: 18px; font-weight: 850; letter-spacing: 0.01em; }
.day-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.day-total { color: var(--green); font-size: 15px; font-weight: 900; letter-spacing: 0.01em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.day-mix { color: var(--muted); font-size: 13px; font-weight: 800; white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.day-jobs { display: grid; gap: 10px; }
.empty-schedule { display: grid; gap: 4px; border: 1px dashed var(--line); border-radius: 8px; padding: 22px; color: var(--muted); background: var(--surface-veil); }
.empty-schedule strong { color: var(--ink); }
.empty-schedule .btn { justify-self: start; margin-top: 8px; }

.job-card, .customer-row { width: 100%; display: grid; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-translucent); color: inherit; text-align: left; }
.job-card { grid-template-columns: 96px minmax(0, 1fr) 42px; gap: 16px; padding: 14px; cursor: pointer; border-left: 6px solid var(--type-fill, var(--green)); background: linear-gradient(to right, color-mix(in srgb, var(--type-fill, var(--green)) 7%, transparent), transparent 55%), var(--surface-translucent); }
.job-card:hover { border-color: var(--blue); border-left-color: var(--type-fill, var(--green)); }
.job-card.status-completed, .job-card.status-canceled { opacity: 0.55; }
.job-card.status-canceled .job-title-row h3, .job-card.status-canceled .row-name { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.job-card.job-flash { animation: jobflash 1.6s ease-out 1; }
@keyframes jobflash { 0% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 55%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.time-block { min-height: 100%; display: grid; align-content: center; gap: 2px; padding: 10px 12px; border-radius: 8px; background: var(--type-fill, var(--tint-2)); color: var(--type-ink, inherit); text-align: center; }
.time-block strong { font-size: 17px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.time-block span { color: inherit; opacity: 0.8; font-size: 12px; white-space: nowrap; }
.job-main { min-width: 0; }
.job-main p { margin-bottom: 8px; min-width: 0; }
.job-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; flex-wrap: wrap; }
.job-title-row h3 { font-size: 16px; font-weight: 800; min-width: 0; }
.job-tags { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.job-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 8px; font-size: 13px; min-width: 0; }
.meta-link { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); text-decoration: none; font-weight: 600; min-width: 0; }
.meta-link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-link .ic { width: 15px; height: 15px; color: var(--blue); }
.meta-link:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.job-note { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--tint-1); color: var(--muted); font-size: 13px; white-space: pre-wrap; }
.job-no-customer { color: var(--amber-ink); font-style: italic; }
.job-card > .icon-button { justify-self: end; }

/* compact rows — the default board */
.job-card.job-row { grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 9px 12px 9px 10px; }
.row-time { display: grid; align-content: center; justify-items: center; gap: 1px; padding: 5px 2px; border-radius: 6px; background: var(--type-fill, var(--tint-2)); color: var(--type-ink, inherit); line-height: 1.1; text-align: center; min-height: 52px; }
.row-time strong { font-size: 12px; font-weight: 850; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-time span { font-size: 10.5px; opacity: 0.85; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-time em { font-size: 9px; font-style: normal; font-weight: 850; letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.9; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main { display: grid; align-content: center; gap: 3px; min-width: 0; }
.row-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 800; }
.row-extra { color: var(--muted); font-weight: 600; }
.row-amount { flex: none; color: var(--green); font-size: 14px; font-weight: 850; font-variant-numeric: tabular-nums; }
.row-line .job-badge { padding: 1px 6px; font-size: 9.5px; }
.row-line-sub { flex-wrap: wrap; row-gap: 6px; }
.row-town { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; font-weight: 700; }
.row-line-sub .status-chip, .row-line-sub .done-toggle { padding: 2px 7px; font-size: 9.5px; letter-spacing: 0.02em; }
.row-line-sub .done-toggle .ic { width: 11px; height: 11px; }
.row-map { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); text-decoration: none; }
.row-map span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row-map .ic { flex: none; color: var(--blue); width: 12px; height: 12px; }
.row-map:hover { text-decoration: underline; color: var(--blue); }
.row-actions { flex: none; display: flex; gap: 4px; margin-left: auto; }
.row-icon { display: grid; place-items: center; width: 32px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-veil); color: var(--ink); }
.row-icon .ic { width: 15px; height: 15px; }
.row-icon:hover { text-decoration: none; border-color: var(--blue); color: var(--blue); }
.row-note { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; font-style: italic; }

.side-panel { border: 1px solid var(--line); border-radius: 8px; background: var(--surface-veil); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 10px; align-content: start; }
.route-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.route-head h2 { font-size: 15px; font-weight: 850; }
.route-count { color: var(--muted); font-size: 12px; font-weight: 800; }
.backlog-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); gap: 8px; }
.backlog-item:last-child { border-bottom: 0; }
.backlog-item small { display: block; color: var(--muted); font-size: 12px; }
a.backlog-item, button.as-row { width: 100%; text-align: left; color: inherit; background: none; border-left: 0; border-right: 0; border-top: 0; font: inherit; }
a.backlog-item:hover, button.as-row:hover { text-decoration: none; background: var(--tint-1); }
a.backlog-item strong, button.as-row strong { color: var(--green-dark); }
.crew-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.crew-share { border-top: 1px solid var(--line); padding-top: 12px; }
.team-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.team-acts { display: flex; gap: 6px; }

/* ---------- jobs: won work & status ---------- */
.jobs-view { display: grid; gap: 14px; }
.won-total { text-align: right; }
.won-total-amt { display: block; font-size: 22px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }
.won-total-n { font-size: 12px; color: var(--muted); font-weight: 700; }
.won-empty { color: var(--muted); font-size: 14px; padding: 24px 4px; }
.won-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.won-chip { padding: 6px 12px; font-size: 12px; font-weight: 800; background: var(--surface); }
.won-group { display: grid; gap: 6px; }
.won-group-head { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.won-group-meta { font-size: 12px; color: var(--muted); font-weight: 700; }
.won-badge { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.5px; padding: 4px 10px; border-radius: 999px; color: #fff; }
.won-badge-unscheduled { background: var(--muted); }
.won-badge-scheduled { background: var(--blue); }
.won-badge-in_progress { background: #b8860b; }
.won-badge-completed { background: #0f8a7e; }
.won-badge-paid { background: var(--green); color: var(--on-green); }
.won-badge-canceled { background: var(--muted); }
.won-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.won-row:hover { border-color: var(--blue); }
.won-row-main { min-width: 0; }
.won-row-name { display: block; font-weight: 800; font-size: 15px; color: var(--ink); }
.won-row-scope { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.won-row-side { text-align: right; flex-shrink: 0; }
.won-row-amt { display: block; font-weight: 900; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.won-row-date { font-size: 12px; color: var(--muted); }

/* ---------- search: history ---------- */
.search-view { display: grid; gap: 16px; }
.search-box { display: flex; align-items: center; gap: 9px; height: 48px; border: 1px solid var(--line); border-radius: 8px; padding: 0 14px; background: var(--surface); }
.search-box .ic { color: var(--muted); width: 18px; height: 18px; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 15px; }
.search-box input::placeholder { color: var(--muted); }
.search-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.search-daterange { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.search-daterange label { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.search-daterange input[type="date"] { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); }
.search-results { display: grid; gap: 10px; }
.result-card { width: 100%; display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 8px; background: var(--surface-translucent); text-align: left; }
.result-card.type-proposal { border-left-color: var(--blue); background: linear-gradient(to right, color-mix(in srgb, var(--blue) 7%, transparent), transparent 55%), var(--surface-translucent); }
.result-card.type-job { border-left-color: var(--amber); background: linear-gradient(to right, color-mix(in srgb, var(--amber) 9%, transparent), transparent 55%), var(--surface-translucent); }
.result-card.type-invoice { border-left-color: var(--green); background: linear-gradient(to right, color-mix(in srgb, var(--green) 7%, transparent), transparent 55%), var(--surface-translucent); }
.result-card.type-client { border-left-color: var(--muted); }
.result-card.is-dead { opacity: 0.66; }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.result-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.result-meta { margin: 0; color: var(--muted); font-size: 13px; }
.result-snippet { margin: 0; font-size: 14px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.result-snippet.muted { color: var(--muted); }
.result-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 2px; align-items: center; }
.result-link { display: inline-flex; align-items: center; gap: 6px; color: var(--blue); font-size: 13px; font-weight: 700; background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; text-align: left; min-width: 0; }
.result-link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
.result-link .ic { width: 15px; height: 15px; }
.result-link:hover { text-decoration: underline; }
.result-edit { color: #fff; background: var(--blue); border-radius: 7px; padding: 5px 10px; }
.result-edit:hover { text-decoration: none; filter: brightness(1.06); }

/* ---------- customers: address book ---------- */
.customers-view { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-veil); box-shadow: var(--shadow); }
.customers-view .search-box { margin: 14px 0; }
.customers-heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.customer-list { display: grid; gap: 10px; }
.customer-row { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px; }
.customer-row[hidden] { display: none; }
.customer-row:hover { border-color: var(--blue); }
.customer-row-main { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; min-width: 0; }
.customer-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 8px; color: var(--on-green); background: var(--green); font-weight: 900; font-size: 16px; }
.customer-row-text { min-width: 0; display: grid; gap: 2px; }
.customer-row-select { display: block; width: 100%; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.customer-row-select:hover { text-decoration: none; }
.customer-row-select:hover strong { color: var(--blue); }
.customer-row strong, .customer-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-row strong { font-size: 15px; font-weight: 800; }
.customer-row small { color: var(--muted); font-size: 12.5px; }
.customer-row-address { display: inline-flex; align-items: center; gap: 5px; color: var(--blue); font-size: 12.5px; font-weight: 700; min-width: 0; text-decoration: none; }
.customer-row-address .ic { flex: 0 0 auto; width: 13px; height: 13px; }
.customer-row-address span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-row-address:hover { text-decoration: underline; text-underline-offset: 3px; }
.customer-row-actions { display: flex; align-items: center; gap: 6px; }
.row-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; text-decoration: none; padding: 0; }
.row-icon-btn .ic { width: 16px; height: 16px; }
.row-icon-btn:hover { color: var(--blue); border-color: var(--blue); text-decoration: none; }
.row-icon-btn.danger:hover { color: var(--red); border-color: var(--red); }

/* ---------- cards / tables / grids (all other pages) ---------- */
.card { background: var(--surface-veil); border-radius: 8px; border: 1px solid var(--line); padding: 16px; margin-bottom: 14px; }
.card h3 { font-size: 12px; margin-bottom: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 800; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: 1fr 1fr 1fr; }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }

table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th { text-align: left; font-size: 11.5px; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 800; }
table.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr:hover td { background: var(--tint-1); }

.stat { font-size: 26px; font-weight: 800; color: var(--green); }
.stat-label { color: var(--muted); font-size: 12.5px; }

/* forms */
.frm label { display: block; font-size: 12px; font-weight: 800; color: var(--muted); margin: 12px 0 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.frm input, .frm select, .frm textarea { width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--surface); color: var(--ink); outline: 0; }
.frm input:focus, .frm select:focus, .frm textarea:focus { border-color: rgba(47, 111, 188, 0.75); box-shadow: 0 0 0 3px rgba(47, 111, 188, 0.13); }
.frm textarea { min-height: 72px; resize: vertical; }
.frm .row { display: flex; gap: 10px; }
.frm .row > div { flex: 1; min-width: 0; }
.frm .actions { margin-top: 16px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.frm .check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.frm .check input { width: auto; min-height: 0; }
.frm input[type="color"] { padding: 2px; }

/* kanban */
.kanban { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: var(--tint-1); border: 1px solid var(--line); border-radius: 10px; padding: 10px; flex: 1; min-width: 190px; }
.kcol h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 2px 4px 10px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.kcard .nm { font-weight: 700; }
.kcard .mt { color: var(--muted); font-size: 12px; margin: 2px 0 8px; }
.kcard .acts { display: flex; gap: 5px; flex-wrap: wrap; }

/* legacy week grid (kept for anything that still draws it) */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day { background: var(--tint-1); border-radius: 10px; padding: 8px; min-height: 180px; }
.day.today { outline: 2px solid var(--green); }
.day h5 { font-size: 12px; color: var(--muted); margin-bottom: 8px; text-align: center; }
.jobcard { border-radius: 8px; padding: 7px 8px; margin-bottom: 6px; font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--green); cursor: pointer; }
.jobcard .t { font-weight: 700; }
.jobcard .m { color: var(--muted); }
.jobcard.done { opacity: 0.55; }

/* proposal builder */
.option-block { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; background: var(--tint-1); }
.item-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: flex-start; }
.item-row select.svc { flex: 1.7; min-width: 150px; height: 38px; }
.item-row input.desc { flex: 3; }
.item-row input.qty { width: 64px; }
.item-row input.price { width: 100px; }
.item-row select.trees { flex: 1.4; min-width: 120px; height: 38px; }
.item-row select.trees[multiple] { height: 58px; }
.item-row .del { border: 0; background: none; color: var(--red); font-size: 16px; padding: 8px 4px; }

/* modal + sheet + toast */
.overlay { position: fixed; inset: 0; background: rgba(23, 33, 29, 0.45); backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal { background: var(--surface-strong); border: 1px solid var(--line); border-radius: 12px; padding: 22px; width: 100%; max-width: 520px; box-shadow: var(--shadow); color: var(--ink); }
.modal.wide { max-width: 760px; }
.modal h3 { margin-bottom: 6px; font-size: 16px; }
.overlay.sheet-backdrop { justify-content: flex-end; align-items: stretch; padding: 18px; }
.modal.sheet { max-width: 520px; width: min(520px, 100%); height: 100%; overflow: auto; border-radius: 8px; padding: 18px; display: grid; gap: 14px; align-content: start; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-head h2 { font-size: 20px; }
.sheet-facts { display: grid; gap: 10px; }
.fact { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-veil); }
.fact > span { color: var(--muted); font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.fact strong { font-size: 15px; }
.fact .linkish { padding: 0; margin-left: 6px; font-size: 12.5px; }
.editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--line); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 10px; font-weight: 600; z-index: 99; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); max-width: 92vw; }
.toast.err { background: var(--red); color: #fff; }

/* tree map */
#tree-map { height: 400px; border-radius: 10px; z-index: 1; }
#tree-map.dropping { cursor: crosshair; }
.tree-pin { width: 28px; height: 28px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45); }
.tree-pin-wrap { background: none; border: 0; }
.leaflet-popup-content { font: 13px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif; color: #1c2420; }

/* guided demo tour */
.tour-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; background: #17211d; color: #fff; border-radius: 14px; padding: 12px 16px; display: flex; gap: 10px; align-items: center; z-index: 200; width: min(680px, 94vw); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35); }
.tour-bar button { background: rgba(255, 255, 255, 0.14); color: #fff; border: 0; border-radius: 8px; padding: 8px 11px; font-size: 14px; flex-shrink: 0; }
.tour-bar button:hover { background: rgba(255, 255, 255, 0.28); }
.tour-cap { flex: 1; min-width: 0; }
.tour-step { font-size: 11px; color: #a9c9b4; text-transform: uppercase; letter-spacing: 0.06em; }
.tour-text { font-size: 13.5px; line-height: 1.45; }
.tour-spot { outline: 3px solid var(--green); outline-offset: 3px; border-radius: 10px; box-shadow: 0 0 0 6px rgba(44, 122, 75, 0.15); }
.tour-frame { position: fixed; inset: 4% 12% 96px; background: #fff; border-radius: 14px; overflow: hidden; z-index: 150; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); }
.tour-frame iframe { width: 100%; height: 100%; border: 0; }
@media (max-width: 800px) { .tour-frame { inset: 2% 2% 110px; } }

code.k { background: var(--tint-1); border: 1px solid var(--line); padding: 2px 7px; border-radius: 6px; font-size: 12px; }

/* list search (tables) */
input.search { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--surface); color: var(--ink); min-width: 210px; }
input.search:focus { border-color: var(--blue); outline: 0; }
.nomatch { padding: 14px 8px; }

/* empty states */
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 18px 4px; color: var(--muted); }
.empty .btn { align-self: flex-start; }

/* coach marks (guided setup) */
.coach { position: fixed; z-index: 210; width: min(340px, 92vw); background: #17211d; color: #fff; border-radius: 14px; padding: 15px 16px 13px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4); }
.coach.coach-corner { right: 18px; bottom: 18px; left: auto !important; top: auto !important; }
.coach.coach-center { left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; }
.coach h4 { font-size: 15.5px; margin: 0 0 6px; }
.coach p { font-size: 13.2px; line-height: 1.5; color: #d6e4da; margin: 0; }
.coach-top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.coach-count { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: #a9c9b4; }
.coach-x { margin-left: auto; background: none; border: 0; color: #a9c9b4; font-size: 14px; padding: 0 2px; }
.coach-x:hover { color: #fff; }
.coach-dots { display: flex; gap: 5px; margin: 12px 0 11px; }
.coach-dots i { width: 100%; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.18); }
.coach-dots i.on { background: #4bbfa6; }
.coach-dots i.cur { background: #fff; }
.coach-acts { display: flex; gap: 7px; justify-content: flex-end; flex-wrap: wrap; }
.coach-acts .btn { background: #4bbfa6; color: #0f1614; }
.coach-acts .btn.ghost { color: #dfeee4; border-color: rgba(255, 255, 255, 0.3); background: transparent; }
.coach-acts .btn.ghost:hover { background: rgba(255, 255, 255, 0.12); }
@media (max-width: 760px) { .coach { left: 8px !important; right: 8px; width: auto; top: auto !important; bottom: 88px; } }

/* price book */
.tabs-row { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabbtn { background: var(--surface-veil); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 700; color: var(--muted); }
.tabbtn:hover { border-color: var(--blue); color: var(--blue); }
.tabbtn.on { background: var(--green); border-color: var(--green); color: var(--on-green); }
.svc-group { margin-bottom: 18px; }
.svc-group h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 6px 2px; }
.svc-group table.tbl { margin-bottom: 0; }

/* lead intake / share your form */
.intake-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--green-soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.intake-url { flex: 1; min-width: 220px; overflow-x: auto; }
.intake-url code { background: var(--surface); }
.intake-acts { display: flex; gap: 8px; flex-shrink: 0; }
.intake-ways { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.intake-ways > div { display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; }
.intake-ways span { font-size: 12.5px; line-height: 1.5; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--green-dark); font: inherit; font-size: 12.5px; font-weight: 600; text-decoration: underline; }
.how-step { border-left: 3px solid var(--green-soft); padding-left: 12px; }
.how-step p { margin-top: 4px; }
.copyable { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copyable code.k { white-space: pre-wrap; word-break: break-all; flex: 1; min-width: 200px; }
@media (max-width: 760px) { .intake-ways { grid-template-columns: 1fr; } }

/* ops dashboard */
.ops-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.ops-head h2 { font-size: 24px; }
.ops-date { color: var(--muted); font-size: 13px; margin-top: 2px; }
.ops-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi { display: block; background: var(--surface-veil); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 8px; padding: 14px 16px; color: inherit; position: relative; box-shadow: var(--shadow); transition: transform 0.15s; }
a.kpi:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--blue); border-left-color: var(--green); }
.kpi.blue { border-left-color: var(--blue); }
.kpi.amber { border-left-color: var(--amber); }
.kpi.red { border-left-color: var(--red); }
.kpi-icon { position: absolute; top: 12px; right: 14px; font-size: 17px; opacity: 0.55; }
.kpi-v { display: block; font-size: 27px; font-weight: 900; color: var(--green); line-height: 1.15; letter-spacing: -0.02em; }
.kpi.blue .kpi-v { color: var(--blue); }
.kpi.amber .kpi-v { color: var(--amber-ink); }
.kpi.red .kpi-v { color: var(--red); }
.kpi-l { display: block; font-weight: 700; font-size: 13px; margin-top: 3px; }
.kpi-s { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.ops-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; align-items: start; }
.tl-row { display: flex; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; font: inherit; color: inherit; }
.tl-row:last-child { border-bottom: 0; }
.tl-row.completed { opacity: 0.62; }
.tl-time { font-size: 12px; font-weight: 700; color: var(--green); width: 66px; flex-shrink: 0; line-height: 1.3; }
.tl-time span { display: block; font-weight: 500; color: var(--muted); }
.tl-body { flex: 1; min-width: 0; }
.tl-body .muted { font-size: 12.5px; }
.att-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 4px; border-bottom: 1px solid var(--line); color: inherit; font-size: 13.5px; }
.att-row:last-child { border-bottom: 0; }
.att-row:hover { text-decoration: none; background: var(--tint-1); }
.fn-row { display: flex; align-items: center; gap: 10px; margin: 9px 0; font-size: 13px; }
.fn-l { width: 76px; color: var(--muted); flex-shrink: 0; }
.fn-bar { flex: 1; background: var(--tint-2); border-radius: 5px; height: 16px; overflow: hidden; }
.fn-bar i { display: block; height: 16px; border-radius: 5px; background: var(--green); min-width: 2px; }
.fn-n { width: 26px; text-align: right; font-weight: 700; flex-shrink: 0; }
.mn-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.mn-row:last-of-type { border-bottom: 0; }
.mn-row.big { padding: 10px 2px 12px; }
.mn-row.big span { display: flex; flex-direction: column; }
.mn-row.big small { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.mn-row.big strong { font-size: 20px; letter-spacing: -0.01em; }
.is-red { color: var(--red); }
.is-green { color: var(--green); }
@media (max-width: 1000px) { .kpis { grid-template-columns: 1fr 1fr; } .ops-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .kpis { grid-template-columns: 1fr; } .ops-head h2 { font-size: 20px; } }

/* send-proposal, payments, crew logins, abuse limits */
.send-alt { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.send-alt strong { font-size: 13px; }
.send-link { width: 100%; margin: 8px 0; font-size: 13px; }
.send-alt-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.cards-off { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; border-left: 4px solid #f2c14e; }
.cards-off p { font-size: 13px; margin-top: 4px; }
.cards-on { border-left: 4px solid var(--green); font-size: 13.5px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.agree { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; font-weight: 400; color: var(--ink); margin-top: 12px; text-transform: none; letter-spacing: 0; }
.agree input { width: auto; min-height: 0; margin-top: 3px; flex: 0 0 auto; }
.agree a { text-decoration: underline; }
.verify-note { background: var(--notice-bg); color: var(--notice-ink); border: 1px solid var(--stripe-b-border); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.verify-note .linkish { padding: 0; margin-left: 4px; color: inherit; }

/* ---------- phones ---------- */
@media (max-width: 920px) {
  .app-shell { display: block; padding-bottom: 84px; }
  .rail { display: none; }
  .workspace { padding: 14px 14px 24px; }
  .topbar { margin-bottom: 14px; }
  .brand-title { font-size: 18px; }
  .brand-sub { display: none; }
  .topbar-actions .primary-action span { display: none; }
  .topbar-actions .primary-action { width: 42px; padding: 0; }
  #coach-btn button { padding: 6px 9px; font-size: 11.5px; }
  .coach-full { display: none; }
  .coach-mini { display: inline; }
  .metric strong { font-size: 18px; }
  .metric-sub { display: block; margin-top: 2px; }
  .content-grid { grid-template-columns: 1fr; }
  .side-panel { order: 2; }
  .hero-strip { gap: 8px; }
  .metric { min-height: 56px; padding: 9px 12px; }
  .metric strong { font-size: 20px; }
  .metric-sub { font-size: 12px; }
  .day-name { font-size: 16px; }
  .bottom-tabs {
    position: fixed; z-index: 20; left: 10px; right: 10px; bottom: 10px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
    padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-translucent); box-shadow: var(--shadow); backdrop-filter: blur(18px);
  }
  .bottom-tabs .nav-button { width: auto; min-height: 48px; }
  .overlay.sheet-backdrop { padding: 10px; }
  .modal.sheet { height: calc(100svh - 20px); }
  .toast { bottom: 88px; }
  .tour-bar { bottom: 84px; }
}
@media (max-width: 620px) {
  h2 { font-size: 20px; }
  .job-card { grid-template-columns: 1fr 38px; }
  .job-card .time-block { grid-column: 1 / -1; min-height: auto; display: grid; grid-template-columns: 1fr auto; justify-content: space-between; align-items: center; padding: 8px 12px; }
  .job-title-row { align-items: flex-start; flex-direction: column; }
  .job-card.job-row { grid-template-columns: 70px minmax(0, 1fr); }
  .section-heading, .editor-actions { align-items: stretch; flex-direction: column; }
  .editor-actions .btn { width: 100%; }
  .customer-row { grid-template-columns: minmax(0, 1fr); }
  .customer-row-actions { flex-wrap: wrap; justify-content: flex-end; }
  .won-row-scope { max-width: 48vw; }
  .frm .row { flex-wrap: wrap; }
  .frm .row > div { flex: 1 1 100%; }
  .modal { padding: 18px; }
  table.tbl { display: block; overflow-x: auto; white-space: nowrap; }
  table.tbl td, table.tbl th { white-space: nowrap; }
  .head-tools { width: 100%; }
  input.search { flex: 1; min-width: 0; }
  .item-row { flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .item-row select.svc, .item-row input.desc, .item-row select.trees { flex: 1 1 100%; min-width: 0; }
  .item-row input.qty { flex: 0 0 72px; }
  .item-row input.price { flex: 1 1 auto; width: auto; min-width: 0; }
}

/* phone: data tables become stacked cards (labels come from cardifyTables in app.js) */
@media (max-width: 760px) {
  table.tbl.cards { display: block; overflow: visible; white-space: normal; }
  table.tbl.cards thead { display: none; }
  table.tbl.cards tbody { display: block; }
  table.tbl.cards tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
  table.tbl.cards tr[hidden] { display: none; }
  table.tbl.cards td { display: block; border: 0; padding: 0; white-space: normal; text-align: left; }
  table.tbl.cards td:first-child { font-weight: 700; }
  table.tbl.cards td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: 11.5px; font-weight: 400; }
  table.tbl.cards td:last-child:has(button, .btn) { flex-basis: 100%; display: flex; gap: 6px; flex-wrap: wrap; }
  table.tbl.cards td[colspan] { flex-basis: 100%; }
}

.day-jobs[hidden] { display: none; }


/* ================= dispatch board, exact: type colours, pulse bar, freeze, drag, swipe, menus ================= */
.job-card { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.job-card.type-estimate { --type-fill: var(--blue); --type-ink: #fff; border-left-color: var(--blue); background: linear-gradient(to right, color-mix(in srgb, var(--blue) 7%, transparent), transparent 55%), var(--surface-translucent); }
.job-card.type-appointment { --type-fill: #14453d; --type-ink: #fff; border-left-color: var(--green); background: linear-gradient(to right, color-mix(in srgb, var(--green) 7%, transparent), transparent 55%), var(--surface-translucent); }
.job-card.type-job { --type-fill: #9a6410; --type-ink: #fff; border-left-color: var(--amber); background: linear-gradient(to right, color-mix(in srgb, var(--amber) 9%, transparent), transparent 55%), var(--surface-translucent); }
:root[data-theme="dark"] .job-card.type-appointment { --type-fill: #1f6b5f; }
:root[data-theme="dark"] .job-card.type-job { --type-fill: #a9772a; }
.job-card.lost { opacity: 0.55; }
.job-card.status-completed, .job-card.status-canceled { opacity: 0.55; }
.job-card:hover { border-color: var(--line); border-left-color: var(--type-fill, var(--green)); }
.job-card:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.job-badge.outcome-won { color: var(--on-green); background: var(--green); border-color: var(--green); }
.job-badge.outcome-lost { color: var(--muted); background: var(--tint-1); border-color: var(--line); }
.job-badge-estimate { color: var(--blue); background: var(--blue-soft); border-color: rgba(47, 111, 188, 0.25); }
.job-badge-appointment { color: var(--green); background: var(--green-soft); border-color: rgba(20, 69, 61, 0.2); }
.job-badge-crew { color: var(--type-ink, #fff); background: var(--type-fill, var(--tint-2)); }
.row-line .job-badge-crew { display: none; }
.job-card .row-time { background: var(--type-fill, var(--tint-2)); color: var(--type-ink, inherit); }
.job-card .time-block { background: var(--type-fill, var(--tint-2)); color: var(--type-ink, inherit); }
.job-no-customer { color: var(--amber-ink); font-style: italic; }
.status-chip-wrap { position: relative; flex-shrink: 0; }
.status-chip { cursor: pointer; }
.status-chip.status-scheduled { color: var(--muted); }
.status-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 61; min-width: 170px; display: grid; padding: 6px; gap: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 14px 34px rgba(10, 20, 16, 0.22); }
.status-option { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 0; border-radius: 7px; background: none; color: var(--ink); font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; text-transform: none; letter-spacing: 0; }
.status-option:hover, .status-option:focus-visible { background: var(--tint-1); }
.status-option.active { font-weight: 800; }
.status-option .ic { margin-left: auto; color: var(--green); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot.status-in_progress { background: var(--blue); }
.status-dot.status-completed { background: var(--green); }
.status-dot.status-canceled { background: var(--line); }
.paid-toggle { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-translucent); color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; cursor: pointer; }
.paid-toggle .ic { width: 13px; height: 13px; }
.paid-toggle.is-paid { color: var(--on-green); background: var(--green); border-color: var(--green); }
.paid-toggle:disabled { opacity: 0.6; cursor: default; }
.paid-toggle:hover:not(.is-paid):not(:disabled) { border-color: var(--green); color: var(--green); }
.row-line-sub .paid-toggle { padding: 2px 7px; font-size: 9.5px; letter-spacing: 0.02em; }
.row-line-sub .paid-toggle .ic { width: 11px; height: 11px; }
.row-line-sub:has(.done-toggle) { flex-wrap: wrap; row-gap: 6px; }

/* slide-to-delete: a red Delete behind the card; the card slides left to uncover it */
.swipe-wrap { position: relative; }
.swipe-wrap .job-card { position: relative; z-index: 1; }
.swipe-wrap:not(.swiping):not(.dragging) .job-card { transition: transform 180ms ease; }
.swipe-delete { position: absolute; top: 0; right: 0; bottom: 0; z-index: 0; width: 88px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; border-radius: 8px; padding: 0; background: var(--red); color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; opacity: 0; pointer-events: none; text-transform: none; }
.swipe-wrap.open .swipe-delete, .swipe-wrap.swiping .swipe-delete { opacity: 1; }
.swipe-wrap.open .swipe-delete { pointer-events: auto; }
.job-card.dragging { position: relative; z-index: 5; cursor: grabbing; opacity: 0.95; box-shadow: 0 16px 34px rgba(0, 0, 0, 0.32); transition: box-shadow 120ms ease; }
.drop-line { height: 3px; border-radius: 999px; background: var(--green); margin: 3px 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }
.day-jobs-folded { padding: 6px 0 0; }

/* pulse bar (compact), board heading, toggles, the frozen head */
.pulse-bar { display: grid; gap: 6px; margin-bottom: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-veil); }
.pulse-stats { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--muted); font-size: 13px; font-weight: 700; }
.pulse-stats b { color: var(--ink); font-size: 15px; font-weight: 850; font-variant-numeric: tabular-nums; }
.pulse-won b { color: var(--green); }
.pulse-next { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.pulse-next-label { flex: none; color: var(--blue); font-weight: 850; }
.pulse-next-who { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.pulse-next-when { flex: none; color: var(--muted); white-space: nowrap; }
.pulse-route { flex: none; display: inline-flex; align-items: center; gap: 4px; margin-left: auto; padding: 5px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 800; text-decoration: none; }
.pulse-route:hover { text-decoration: none; filter: brightness(1.05); }
.board-heading { margin-bottom: 10px; }
.board-heading-actions { display: flex; align-items: center; gap: 8px; }
.density-toggle { display: inline-flex; align-items: center; gap: 5px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-veil); color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; }
.density-toggle:hover { border-color: var(--blue); color: var(--blue); }
.board-toggles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.board-toggles:empty { display: none; }
.past-toggle { padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-veil); color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.past-toggle:hover { border-color: var(--blue); color: var(--blue); }
.fold-toggle { display: inline-flex; align-items: center; gap: 6px; }
.board-freeze { position: sticky; top: 0; z-index: 10; margin: -24px -28px 12px; padding: 14px 28px 8px; border-bottom: 1px solid var(--line); background: var(--paper); }
.board-freeze .board-heading { flex-direction: row; align-items: center; margin-bottom: 8px; }
.board-freeze .board-heading h2 { font-size: 18px; }
.board-freeze .past-toggle { padding: 5px 10px; font-size: 12px; }
.board-freeze .pulse-bar { margin-bottom: 8px; }
.board-freeze .board-toggles { flex-wrap: nowrap; overflow-x: auto; margin-bottom: 0; scrollbar-width: none; }
.board-freeze .board-toggles::-webkit-scrollbar { display: none; }
.board-freeze .board-toggles .past-toggle { flex: none; }
.board-compact .day-heading { top: var(--freeze-h, 0px); }
.day-group:nth-of-type(odd) .day-heading { background: var(--surface); }
.to-top { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 30; width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 999px; color: var(--on-green); background: var(--green); box-shadow: var(--shadow); cursor: pointer; padding: 0; }
.route-panel .route-body { display: grid; gap: 3px; margin-bottom: 12px; font-size: 14px; min-width: 0; }
.route-when { color: var(--muted); font-size: 13px; font-weight: 700; }
.route-empty { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.route-panel .wide-action { margin-bottom: 4px; }

/* the job editor */
.ed-head-right { display: flex; align-items: center; gap: 10px; }
.field { display: grid; gap: 7px; }
.field > span { color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: 0.04em; }
.field.full-span { grid-column: 1 / -1; }
.field input, .field select { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; color: var(--ink); background: var(--surface); outline: 0; font: inherit; }
.field input:focus, .field select:focus { border-color: rgba(47, 111, 188, 0.75); box-shadow: 0 0 0 3px rgba(47, 111, 188, 0.13); }
.notes-input { width: 100%; min-height: 76px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); outline: 0; font: inherit; resize: vertical; }
.notes-input:focus { border-color: rgba(47, 111, 188, 0.75); box-shadow: 0 0 0 3px rgba(47, 111, 188, 0.13); }
.segmented { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--tint-1); }
.segment { min-height: 38px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 800; cursor: pointer; padding: 0 8px; }
.segment:hover { color: var(--ink); }
.segment.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }
.segment.type-estimate.active { color: var(--blue); box-shadow: inset 0 0 0 2px var(--blue); }
.segment.type-appointment.active { color: var(--green); box-shadow: inset 0 0 0 2px var(--green); }
.segment.type-job.active { color: var(--amber-ink); box-shadow: inset 0 0 0 2px var(--amber); }
.money-input { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 0 12px; }
.money-input > span { color: var(--muted); font-weight: 800; }
.money-input input { border: 0; padding: 0; min-height: 44px; background: transparent; }
.money-input input:focus { box-shadow: none; }
.money-input:focus-within { border-color: rgba(47, 111, 188, 0.75); box-shadow: 0 0 0 3px rgba(47, 111, 188, 0.13); }
.customer-search { position: relative; }
.customer-results[hidden] { display: none; }
.customer-result[role="option"] { cursor: pointer; }
.address-custom-note { margin: 6px 2px 0; font-size: 12px; color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 600; }
.address-reset { border: 0; background: none; padding: 0; color: var(--blue); font: inherit; font-size: 12px; font-weight: 700; text-decoration: underline; cursor: pointer; }
.contact-save-note { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; }
.contact-save-note.error { color: var(--red); }
.estimate-send-custom { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.estimate-send-input { flex: 1 1 200px; min-height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: var(--surface); color: var(--ink); font: inherit; outline: 0; }
.estimate-send-input:focus { border-color: rgba(47, 111, 188, 0.75); }
.svc-pick { display: grid; gap: 10px; }
.svc-pick-group small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.svc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.svc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer; text-transform: none; letter-spacing: 0; }
.svc-chip:hover { border-color: var(--blue); }
.svc-chip.active { background: var(--green); border-color: var(--green); color: var(--on-green); }
.svc-chip-price { font-size: 11.5px; opacity: 0.8; font-variant-numeric: tabular-nums; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-thumb { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--tint-1); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 999px; background: rgba(23, 33, 29, 0.72); color: #fff; cursor: pointer; padding: 0; }
.photo-del:hover { background: var(--red); }
.photo-add { width: 84px; height: 84px; display: grid; place-items: center; align-content: center; gap: 2px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; text-align: center; text-transform: none; letter-spacing: 0; }
.photo-add:hover { border-color: var(--blue); color: var(--blue); }
.photo-add input { display: none; }
.photo-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.photo-notice { margin: 6px 0 0; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; }
.photo-notice:empty { display: none; }
.photo-notice.ok { color: #1f8a54; }
.photo-notice.warn { color: var(--red); }
.video-list { display: grid; gap: 10px; margin-bottom: 8px; }
.video-item { display: grid; gap: 6px; }
.video-item video { width: 100%; max-height: 240px; border-radius: 8px; background: #000; }
.video-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.video-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; text-transform: none; letter-spacing: 0; font-weight: 600; }
.video-meta .photo-del { position: static; }
.video-add, .sms-video-add { cursor: pointer; }
.video-add.busy { opacity: 0.7; cursor: progress; }
.video-add input { display: none; }
.qb-estimate { display: grid; gap: 8px; }
.qb-estimate-done { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; font-weight: 700; color: var(--green); flex-wrap: wrap; }
.qb-estimate-done span { flex: 1 1 auto; min-width: 0; }
.qb-estimate-hint { margin: 0; color: var(--muted); font-size: 12px; }
.sms-choice { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--tint-1); }
.sms-choice-label { color: var(--muted); font-size: 13px; font-weight: 700; }
.sms-choice-hint { margin: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.sms-choice-hint.error { color: var(--red); }
.sms-choice-cancel { justify-self: center; padding: 4px 8px; border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; }
.outcome-row { display: flex; flex-wrap: wrap; gap: 8px; }
.outcome-row .secondary-action { flex: 1 1 auto; }
.outcome-won-btn { color: var(--green); }
.outcome-lost-btn { color: var(--muted); }
.modal.sheet .section-heading { margin-bottom: 6px; }
.modal.sheet .editor-actions { justify-content: space-between; }
@media (max-width: 920px) {
  .board-freeze { margin: -14px -14px 10px; padding: 10px 14px 6px; }
  .content-grid.board-compact { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .segmented { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board-heading-actions { gap: 6px; }
  .density-toggle span { display: none; }
  .row-line .row-amount { font-size: 13px; }
}
