/* AFSD Quote Desk V1 — Jobber Visual & Workflow Fidelity Theme
   Calibrated directly from AFSD's signed-in Jobber workspace screenshots (2026-11-21).
   "Jobber on the surface, AFSD's own system underneath." */

:root {
  --shell-bg: #eeeeec;
  --shell-border: #dfdfd9;
  --canvas-bg: #ffffff;
  --surface-warm: #f5f4ef;
  --surface-subtle: #f8f8f6;
  --ink: #0f2438;
  --ink-secondary: #4e5d6b;
  --ink-muted: #6c7985;
  --border: #e1e4e2;
  --border-input: #cbd1ce;
  --green: #3d8328;
  --green-hover: #316c1f;
  --green-soft: #e3f3df;
  --green-text: #276316;
  --maroon: #7c223b;
  --maroon-soft: #f7e6eb;
  --blue-soft: #e3effb;
  --blue-dot: #2b72c6;
  --blue-text: #1c5090;
  --amber-soft: #fbf3d5;
  --amber-dot: #d49b1a;
  --amber-text: #7a5600;
  --red-soft: #fce5e5;
  --red-dot: #c93636;
  --red-text: #8f1d1d;
  --grey-soft: #eaeceb;
  --grey-dot: #6b7680;
  --grey-text: #455059;
  --info-bg: #e9f2fc;
  --info-border: #c4dbf5;
  --info-ink: #1b4d85;
  --sidebar-w: 188px;
  --topbar-h: 56px;
  --radius: 8px;
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--shell-bg);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--shell-bg); color: var(--ink); }
a { color: var(--green-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Global Top Bar (matches Jobber 56px warm stone utility bar) ---- */
.j-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--shell-bg);
  border-bottom: 1px solid var(--shell-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 60;
  gap: 12px;
}
.j-topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.j-monogram {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 11px; letter-spacing: -0.02em;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
}
.j-company-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.j-local-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e1e9de;
  color: var(--green-text);
  border: 1px solid #c5d9bf;
  white-space: nowrap;
}

.j-topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.j-global-search-wrap { position: relative; width: 290px; }
.j-global-search {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: #e1e1dd;
  color: var(--ink);
  font-size: 13.5px;
  outline: none;
}
.j-global-search:focus { background: #fff; border-color: var(--green); box-shadow: 0 0 0 2px rgba(61,131,40,0.14); }
.j-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-secondary); pointer-events: none; font-size: 14px; }
.j-search-results {
  position: absolute; top: 40px; left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 36, 56, 0.14);
  z-index: 100;
  max-height: 360px;
  overflow-y: auto;
}
.j-search-group { padding: 6px 10px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--ink-muted); letter-spacing: 0.04em; background: var(--surface-subtle); }
.j-search-hit {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  width: 100%; text-align: left; border: none; background: #fff; padding: 8px 12px; cursor: pointer; font-size: 13px; color: var(--ink);
}
.j-search-hit:hover { background: var(--surface-warm); }

.j-icon-btn {
  position: relative;
  width: 34px; height: 34px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.j-icon-btn:hover { background: rgba(15, 36, 56, 0.08); }
.j-icon-badge {
  position: absolute; top: 2px; right: 1px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px;
  background: #c93636; color: #fff;
  font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.j-role-select {
  height: 32px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--border-input);
  background: #fff;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
}

/* ---- App Shell & Left Sidebar (matches Jobber 188px stone nav) ---- */
.j-layout {
  display: flex;
  padding-top: var(--topbar-h);
  min-height: 100vh;
}
.j-sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--shell-bg);
  padding: 10px 8px 12px;
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow-y: auto;
  transition: width 0.16s ease;
}
body.sidebar-collapsed { --sidebar-w: 62px; }
body.sidebar-collapsed .j-nav-label,
body.sidebar-collapsed .j-nav-count { display: none; }

.j-create-wrap { position: relative; margin-bottom: 6px; }
.j-nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  margin-bottom: 2px;
}
.j-nav-btn:hover { background: rgba(15, 36, 56, 0.06); }
.j-nav-btn.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 36, 56, 0.08);
}
.j-nav-btn svg { width: 17px; height: 17px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.9; }
.j-nav-create-icon {
  width: 20px; height: 20px; border-radius: 999px;
  background: var(--ink); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; line-height: 1; flex-shrink: 0;
}
.j-nav-divider { border: 0; border-top: 1px solid #d9dad5; margin: 8px 6px; }
.j-nav-count {
  margin-left: auto;
  font-size: 11px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px;
  background: #dfe1dc; color: var(--ink-secondary);
}
.j-nav-count.warn { background: var(--amber-soft); color: var(--amber-text); }
.j-sidebar-footer { margin-top: auto; padding-top: 8px; }

/* ---- Main Canvas ---- */
.j-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  background: var(--canvas-bg);
  border-top-left-radius: 10px;
  box-shadow: -1px 0 0 var(--shell-border);
  min-height: calc(100vh - var(--topbar-h));
  display: flex;
  flex-direction: column;
}
.j-main.quote-accent { border-top: 3px solid var(--maroon); border-top-left-radius: 0; }
.j-page { padding: 24px 28px 96px; max-width: 1360px; width: 100%; }
.j-page-flush { padding: 0; width: 100%; flex: 1; display: flex; min-height: calc(100vh - var(--topbar-h) - 3px); }

/* ---- Notice Toast ---- */
.j-notice {
  margin: 12px 28px 0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  display: none;
}
.j-notice.show { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.j-notice.ok { background: var(--green-soft); color: var(--green-text); border: 1px solid #b6dfa9; }
.j-notice.error { background: var(--red-soft); color: var(--red-text); border: 1px solid #efb2b2; }
.j-notice.warn { background: var(--amber-soft); color: var(--amber-text); border: 1px solid #ebd082; }

/* ---- Typography & Buttons (exact Jobber green CTA & outlined buttons) ---- */
h1.j-h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); line-height: 1.2; }
h2.j-h2 { margin: 0 0 10px; font-size: 18px; font-weight: 700; color: var(--ink); }
h3.j-h3 { margin: 0 0 8px; font-size: 15px; font-weight: 700; color: var(--ink); }
.j-muted { color: var(--ink-muted); font-size: 13px; }
.j-num { font-variant-numeric: tabular-nums; }
.j-mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }
.j-pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.j-header-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
.j-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.j-btn, a.j-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 15px;
  border-radius: 8px;
  border: 1px solid var(--border-input);
  background: #fff; color: var(--ink);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.j-btn:hover, a.j-btn:hover { background: var(--surface-subtle); text-decoration: none; }
.j-btn-primary, a.j-btn-primary {
  background: var(--green); border-color: var(--green); color: #fff;
}
.j-btn-primary:hover, a.j-btn-primary:hover { background: var(--green-hover); border-color: var(--green-hover); color: #fff; }
.j-btn-outline-green { color: var(--green-text); border-color: var(--border-input); background: #fff; }
.j-btn-outline-green:hover { background: var(--green-soft); border-color: var(--green); }
.j-btn-danger { color: var(--red-text); border-color: #e4b4b4; background: #fff; }
.j-btn-danger:hover { background: var(--red-soft); }
.j-btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; }
.j-btn-icon { width: 36px; height: 36px; padding: 0; }
.j-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.j-link-btn {
  border: none; background: transparent; padding: 0;
  color: var(--green-text); font-weight: 600; font-size: 13.5px;
  text-decoration: underline; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}

/* Split Save Button (exact Jobber Save Quote + chevron) */
.j-split-btn { position: relative; display: inline-flex; }
.j-split-btn > .j-btn-primary:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.j-split-btn > .j-btn-primary:nth-child(2) {
  border-top-left-radius: 0; border-bottom-left-radius: 0;
  border-left: 1px solid rgba(255,255,255,0.28);
  padding: 0 10px;
}

/* Dropdown Popover */
.j-menu-wrap { position: relative; display: inline-flex; }
.j-menu {
  position: absolute; top: calc(100% + 5px); right: 0;
  min-width: 210px;
  background: #fff;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(15, 36, 56, 0.14);
  padding: 5px;
  z-index: 90;
}
.j-menu.left { right: auto; left: 0; }
.j-menu.up { top: auto; bottom: calc(100% + 6px); }
.j-menu-item {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: none; background: transparent;
  color: var(--ink); font-size: 13.5px; font-weight: 500;
  border-radius: 6px; cursor: pointer; text-align: left; text-decoration: none;
}
.j-menu-item:hover { background: var(--surface-warm); text-decoration: none; }
.j-menu-item.danger { color: var(--red-text); }
.j-menu-sep { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* ---- KPI Strip (Clients & Quotes Overview Cards) ---- */
.j-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.j-kpi-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 112px;
}
.j-kpi-card.warm { background: var(--surface-warm); }
.j-kpi-title { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.j-kpi-sub { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.j-kpi-val { font-size: 24px; font-weight: 800; color: var(--ink); margin-top: 12px; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 8px; }
.j-overview-bullets { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; font-size: 12.5px; color: var(--ink-secondary); }
.j-overview-bullets li { display: flex; align-items: center; gap: 7px; }
.j-dot { width: 7px; height: 7px; border-radius: 999px; display: inline-block; flex-shrink: 0; }
.j-dot.draft { background: var(--grey-dot); }
.j-dot.awaiting_response { background: var(--amber-dot); }
.j-dot.changes_requested { background: var(--red-dot); }
.j-dot.approved, .j-dot.active { background: var(--green); }
.j-dot.lead { background: var(--blue-dot); }
.j-dot.archived, .j-dot.inactive { background: var(--grey-dot); }

/* ---- Status Pills (exact Jobber rounded pill with leading dot) ---- */
.j-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.j-pill.active, .j-pill.approved, .j-pill.sent { background: var(--green-soft); color: var(--green-text); }
.j-pill.lead { background: var(--blue-soft); color: var(--blue-text); }
.j-pill.awaiting_response, .j-pill.unknown_hold { background: var(--amber-soft); color: var(--amber-text); }
.j-pill.changes_requested, .j-pill.failed { background: var(--red-soft); color: var(--red-text); }
.j-pill.draft, .j-pill.archived, .j-pill.inactive, .j-pill.suppressed { background: var(--grey-soft); color: var(--grey-text); }

/* ---- Filter Bar & Data Tables ---- */
.j-list-heading { font-size: 16px; font-weight: 700; margin: 0 0 12px; color: var(--ink); }
.j-list-heading span { font-weight: 400; color: var(--ink-muted); font-size: 14px; }
.j-filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.j-filter-pills { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.j-filter-pill {
  height: 36px; padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-input);
  background: #fff; color: var(--ink);
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
}
.j-filter-pill.active { background: #e3e2dc; border-color: #d0cfc8; font-weight: 600; }
.j-filter-pill select {
  border: none; background: transparent; font: inherit; color: inherit; outline: none; cursor: pointer; padding: 0;
}
.j-search-box {
  position: relative; width: 250px;
}
.j-search-box input {
  width: 100%; height: 36px; padding: 0 12px 0 32px;
  border: 1px solid var(--border-input); border-radius: 8px;
  font-size: 13.5px; background: #fff; color: var(--ink);
}

.j-table-wrap { width: 100%; overflow-x: auto; }
.j-table { width: 100%; border-collapse: collapse; }
.j-table th {
  text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-muted);
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.j-table td {
  padding: 12px; border-bottom: 1px solid #eef0ef; vertical-align: middle; font-size: 13.5px;
}
.j-table tbody tr { cursor: pointer; transition: background 0.1s ease; }
.j-table tbody tr:hover { background: #f8f9f8; }
.j-table .col-right { text-align: right; }
.j-row-title { font-weight: 600; color: var(--ink); }
.j-row-sub { font-size: 12.5px; color: var(--ink-muted); margin-top: 2px; }

/* ---- Jobber Form Sections (New Client two-column split + grouped inputs) ---- */
.j-form-container { max-width: 960px; margin: 0 auto; padding: 26px 28px 110px; }
.j-form-section {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 32px;
  padding: 20px 0 28px;
  border-bottom: 1px solid var(--border);
}
.j-form-section:last-of-type { border-bottom: none; }
.j-form-left h2 { margin: 0 0 6px; font-size: 16px; font-weight: 700; color: var(--ink); }
.j-form-left p { margin: 0 0 14px; font-size: 12.5px; color: var(--ink-muted); }

.j-input-group {
  border: 1px solid var(--border-input);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  margin-bottom: 14px;
}
.j-input-row { display: grid; border-bottom: 1px solid var(--border-input); }
.j-input-row:last-child { border-bottom: none; }
.j-input-row.cols-3 { grid-template-columns: 95px 1fr 1fr; }
.j-input-row.cols-2 { grid-template-columns: 1fr 1fr; }
.j-input-cell { position: relative; border-right: 1px solid var(--border-input); }
.j-input-cell:last-child { border-right: none; }
.j-input-cell input, .j-input-cell select {
  width: 100%; height: 44px; border: none; outline: none;
  padding: 0 12px; font-size: 14px; color: var(--ink); background: transparent;
}
.j-input-cell input:focus, .j-input-cell select:focus { background: #fbfdfb; }

.j-field { margin-bottom: 12px; }
.j-field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.j-input, .j-select, .j-textarea {
  width: 100%;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
}
.j-input, .j-select { height: 42px; }
.j-textarea { min-height: 82px; resize: vertical; }
.j-input:focus, .j-select:focus, .j-textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 2px rgba(61,131,40,0.12); }

/* Warm Cream Collapsible Accordions (matches Jobber Additional client details / Property details) */
.j-accordion {
  background: var(--surface-warm);
  border-radius: 8px;
  margin-top: 12px;
  overflow: hidden;
}
.j-accordion summary {
  list-style: none;
  padding: 13px 16px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
}
.j-accordion summary::-webkit-details-marker { display: none; }
.j-accordion-body { padding: 4px 16px 16px; }

.j-sticky-bar {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 12px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  z-index: 45;
}

/* ---- Two-Column Detail Screen (Client Detail & Quote Detail — matches step_22 & step_32) ---- */
.j-detail-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 295px;
  width: 100%;
  min-height: calc(100vh - var(--topbar-h) - 3px);
}
.j-detail-main { padding: 22px 28px 60px; min-width: 0; }
.j-detail-rail {
  border-left: 1px solid var(--border);
  padding: 18px 16px 40px;
  background: #fcfcfb;
  display: flex; flex-direction: column; gap: 14px;
}
.j-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.j-card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.j-tabs-underline {
  display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin: 18px 0 16px;
}
.j-tab-u {
  border: none; background: transparent; padding: 8px 2px 10px;
  font-size: 14px; font-weight: 600; color: var(--ink-secondary);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.j-tab-u.active { color: var(--ink); border-bottom-color: var(--green); }

.j-kv-list { border-top: 1px solid #edf0ee; }
.j-kv-row {
  display: grid; grid-template-columns: 130px minmax(0, 1fr);
  gap: 10px; align-items: center;
  padding: 9px 0; border-bottom: 1px solid #edf0ee;
  font-size: 13.5px;
}
.j-kv-label { color: var(--ink-secondary); font-weight: 500; }

.j-notes-drop {
  border: 1.5px dashed #cfd4d1;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

/* ---- Quote Editor Line Items & Add Section Strip ---- */
.j-add-section-strip {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface-warm);
  padding: 6px 10px;
  border-radius: 8px;
  margin: 14px 0;
  font-size: 13px; font-weight: 600; color: var(--ink-secondary);
}
.j-chip-btn {
  height: 28px; padding: 0 11px;
  border-radius: 6px; border: 1px solid var(--border-input);
  background: #fff; color: var(--ink); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.j-chip-btn:hover { border-color: var(--green); color: var(--green-text); }

.j-line-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fff;
}
.j-line-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px 115px 115px 32px;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.j-line-body-with-thumb {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.j-line-thumb-wrap {
  position: relative;
  flex: 0 0 68px;
}
.j-line-thumb {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  display: block;
  cursor: zoom-in;
}
.j-line-thumb-clear {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #4b5563;
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.j-line-thumb-clear:hover { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.j-item-cell-flex {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.j-item-thumb-sm {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  display: block;
  cursor: zoom-in;
}
.j-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.76);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: zoom-out;
}
.j-lightbox-card {
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35);
  cursor: default;
}
.j-lightbox-card img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 6px;
  display: block;
  margin: 0 auto 8px;
}
.j-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.j-brand-btn {
  display: inline-flex;
  align-items: center;
  border: none;
  background: transparent;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.j-brand-btn:hover { background: rgba(31, 59, 77, 0.06); }
.j-brand-logo-full {
  height: 34px;
  width: auto;
  display: block;
}
.j-brand-logo-icon {
  height: 30px;
  width: 30px;
  border-radius: 7px;
  display: none;
}
.j-brand-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  flex-shrink: 0;
}
.j-quinn-home-greet {
  display: flex;
  align-items: center;
  gap: 14px;
}
.j-quinn-avatar {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(31, 59, 77, 0.14);
}
.j-quinn-login-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 16px;
}
.j-quinn-login-hero img.quinn-login-mascot {
  height: 118px;
  width: auto;
  margin-bottom: 8px;
}
.j-quinn-login-hero img.quinn-login-logo {
  height: 44px;
  width: auto;
  margin-bottom: 6px;
}
.j-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding: 2px;
}
.j-photo-tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.j-photo-tile:hover {
  border-color: var(--green);
  box-shadow: 0 2px 8px rgba(61, 131, 40, 0.12);
}
.j-photo-tile img {
  width: 100%;
  height: 84px;
  object-fit: cover;
  border-radius: 5px;
  display: block;
  margin-bottom: 5px;
  background: #f9fafb;
}
.j-photo-tile-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.j-photo-tile-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: rgba(255, 255, 255, 0.94);
  color: #6b7280;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.j-photo-tile-del:hover { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.j-totals-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}
.j-totals-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #eef0ef; font-size: 14px;
}
.j-totals-row.grand {
  border-top: 2px solid var(--ink); border-bottom: none;
  font-weight: 800; font-size: 16px; padding-top: 11px;
}

/* ---- Settings Two-Pane + Automations Cards + Slide-over Drawer (step_36 & step_38) ---- */
.j-settings-layout {
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  width: 100%;
  min-height: calc(100vh - var(--topbar-h));
}
.j-settings-nav {
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  background: #fff;
}
.j-settings-nav h2 { margin: 0 0 16px 8px; font-size: 17px; font-weight: 800; }
.j-settings-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink); margin: 16px 0 6px 8px; }
.j-settings-link {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent; padding: 6px 8px; border-radius: 6px;
  font-size: 13.5px; color: var(--ink-secondary); cursor: pointer; margin-bottom: 2px;
}
.j-settings-link:hover { background: var(--surface-subtle); color: var(--ink); }
.j-settings-link.active { color: var(--green-text); font-weight: 700; }

.j-auto-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 260px));
  gap: 14px;
  margin: 10px 0 24px;
}
.j-auto-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 14px;
  min-height: 150px;
  box-shadow: 0 1px 2px rgba(15,36,56,0.04);
}
.j-auto-card:hover { border-color: var(--green); box-shadow: 0 4px 12px rgba(15,36,56,0.08); }
.j-auto-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.j-auto-icons { display: flex; align-items: center; gap: 6px; }
.j-auto-icon-box {
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--surface-warm); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
}
.j-auto-title { font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.3; }

/* Slide-over Drawer (Automation rule config — matches step_38_shot_1) */
.j-drawer-backdrop {
  position: fixed; inset: 0; background: rgba(15, 36, 56, 0.25); z-index: 120;
  display: flex; justify-content: flex-end;
}
.j-drawer {
  width: 410px; max-width: 96vw; height: 100%;
  background: #fff; box-shadow: -8px 0 28px rgba(15, 36, 56, 0.16);
  display: flex; flex-direction: column;
}
.j-drawer-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.j-drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.j-drawer-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; }

.j-flow-step {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 13px 14px;
  background: #fff;
  margin-bottom: 6px;
}
.j-flow-label { text-align: center; font-style: italic; font-size: 12px; color: var(--ink-muted); margin: 8px 0 6px; }

/* Modal (Communication Settings, New Quote Chooser, Template Editor — matches step_20_shot_1 & step_52) */
.j-modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 36, 56, 0.45);
  z-index: 140; display: flex; align-items: center; justify-content: center; padding: 16px;
}
.j-modal {
  background: #fff; border-radius: 12px; width: 540px; max-width: 100%;
  max-height: 92vh; overflow-y: auto;
  box-shadow: 0 20px 50px rgba(15, 36, 56, 0.25);
  padding: 22px 24px;
}
.j-modal.wide { width: 820px; }
.j-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.j-modal-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.j-info-banner {
  background: var(--info-bg); border: 1px solid var(--info-border); color: var(--info-ink);
  border-radius: 8px; padding: 10px 12px; font-size: 13px; margin: 10px 0 14px;
}

/* Toggle Switch (matches Jobber green switch in Communication Settings) */
.j-switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid #f0f2f1; font-size: 13.5px;
}
.j-switch-row:last-child { border-bottom: none; }
.j-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.j-switch input { opacity: 0; width: 0; height: 0; }
.j-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #a5adb3; border-radius: 999px; transition: 0.16s;
}
.j-slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: 0.16s;
}
.j-switch input:checked + .j-slider { background: var(--green); }
.j-switch input:checked + .j-slider::before { transform: translateX(18px); }

.j-template-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
.j-preview-box {
  background: var(--surface-warm); border-radius: 8px; padding: 14px 16px; font-size: 13.5px;
}

/* Alert banners */
.j-alert { padding: 11px 14px; border-radius: 8px; font-size: 13.5px; margin: 10px 0; }
.j-alert.warn { background: var(--amber-soft); border: 1px solid #ebd082; color: var(--amber-text); }
.j-alert.internal { background: #f6f3fb; border: 1px dashed #b4a2dc; color: #3c2a6b; }

/* Timeline */
.j-timeline { list-style: none; padding: 0; margin: 8px 0 0; }
.j-timeline li { border-left: 2px solid var(--border-input); padding: 2px 0 10px 12px; margin-left: 5px; font-size: 13px; }

/* Message Center Drawer (exact Jobber sage-green outbound / light-grey inbound bubbles) */
.j-mc-thread-item {
  width: 100%; text-align: left; border: none; border-bottom: 1px solid #eef0ef;
  background: #fff; padding: 12px 14px; cursor: pointer; display: block;
}
.j-mc-thread-item:hover { background: var(--surface-subtle); }
.j-mc-thread-item.unread { background: #fbfcf9; }
.j-mc-bubbles { display: flex; flex-direction: column; gap: 10px; }
.j-bubble {
  max-width: 86%; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.4;
}
.j-bubble.outbound { align-self: flex-end; background: #e3f1df; color: var(--ink); border-bottom-right-radius: 3px; }
.j-bubble.inbound { align-self: flex-start; background: #eff1f0; color: var(--ink); border-bottom-left-radius: 3px; }
.j-bubble-meta { font-size: 11px; color: var(--ink-muted); margin-top: 4px; display: flex; justify-content: space-between; gap: 8px; }
.j-notif-item {
  width: 100%; text-align: left; border: none; border-bottom: 1px solid #eef0ef;
  background: #fff; padding: 10px 12px; cursor: pointer; display: block;
}
.j-notif-item.unread { background: #f3f9f1; }
.j-notif-item:hover { background: var(--surface-warm); }

/* ---- Mobile Responsive Support (Preserves desktop parity first, clean phone usability) ---- */
@media (max-width: 960px) {
  .j-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .j-detail-split { grid-template-columns: 1fr; }
  .j-detail-rail { border-left: none; border-top: 1px solid var(--border); }
  .j-form-section { grid-template-columns: 1fr; gap: 12px; }
  .j-totals-grid { grid-template-columns: 1fr; }
  .j-settings-layout { grid-template-columns: 1fr; }
  .j-settings-nav { border-right: none; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; }
  .j-settings-nav h2, .j-settings-group { display: none; }
  .j-settings-link { width: auto; }
  .j-auto-grid { grid-template-columns: 1fr; }
  .j-template-grid { grid-template-columns: 1fr; }
}
.j-mobile-menu-btn { display: none; font-size: 18px; }
@media (max-width: 720px) {
  :root { --sidebar-w: 0px; }
  .j-mobile-menu-btn { display: inline-flex; }
  .j-sidebar { display: none; }
  body.mobile-nav-open .j-sidebar { display: flex; width: 210px; box-shadow: 6px 0 24px rgba(0,0,0,0.18); }
  .j-topbar { padding: 0 8px; gap: 6px; }
  .j-topbar-right { gap: 4px; flex: 1; justify-content: flex-end; min-width: 0; }
  .j-global-search-wrap { flex: 1; min-width: 90px; max-width: 150px; width: auto; }
  .j-role-select { max-width: 105px; font-size: 11.5px; }
  .j-company-name, .j-local-pill, .j-brand-sep, .j-brand-logo-full { display: none; }
  .j-brand-logo-icon { display: block; }
  .j-page, .j-form-container, .j-detail-main { padding: 14px 14px 96px; }
  .j-two-col { grid-template-columns: 1fr; gap: 14px; }
  .j-line-top { grid-template-columns: 72px 1fr 1fr 34px; }
  .j-line-top > :first-child { grid-column: 1 / -1; }
  .j-line-body-with-thumb { flex-direction: column; gap: 8px; }
  .j-header-row { gap: 8px; }
  .j-actions { flex-wrap: wrap; }
  .j-btn { min-height: 36px; }
  .j-sticky-bar { padding: 10px 14px; }
  .j-input-row.cols-3, .j-input-row.cols-2 { grid-template-columns: 1fr; }
}

@media print {
  .j-topbar, .j-sidebar, .j-sticky-bar, .no-print { display: none !important; }
  .j-main { margin-left: 0 !important; }
}
