/* Purple Painting Dashboard styles.
   Design tokens come first: change colors, fonts and radii here, not in pages.
   Values are from dashboard/SPEC.md section 5. */
:root {
  --purple-900: #2E1248;   /* header / nav background */
  --purple-700: #4A1F73;   /* dark accent, links */
  --purple-600: #6B2FA3;   /* primary accent: buttons, active chips, key numbers */
  --purple-100: #D9CCE8;   /* secondary text on dark */
  --purple-50:  #F1EBF8;   /* tinted fills */

  --bg:         #F7F6FA;
  --card:       #FFFFFF;
  --border:     #E3DDEB;
  --text:       #1C1726;
  --muted:      #5E566B;

  --warn-text:  #9A3412;
  --warn-bg:    #FDEBD8;
  --good-text:  #1E5631;
  --good-bg:    #E6F2EA;

  /* Hiring position colours (avatar and position dot). Field crew warm, office and sales cool; dark text on a tint (WCAG AA). */
  --pos-painter-bg: #DCC8F0; --pos-painter: #4A1F73;
  --pos-helper-bg:  #F4EFFB; --pos-helper:  #5F4385;
  --pos-foreman-bg: #2E1248; --pos-foreman: #FFFFFF;
  --pos-stainer-bg: #FBE8C4; --pos-stainer: #6E4300;
  --pos-office-bg:  #D5F0EC; --pos-office:  #0B5750;
  --pos-sales-bg:   #DCE9FB; --pos-sales:   #1B4C86;
  --pos-unknown-bg: #ECEBEF; --pos-unknown: #52505B;
  /* Solid versions for the small dots in the filters and legend (never the only cue: the label is always next to it). */
  --dot-painter: #6B2FA3; --dot-helper: #A98BD2; --dot-foreman: #2E1248; --dot-stainer: #C2861A; --dot-office: #138A80; --dot-sales: #2F6DB5; --dot-unknown: #A3A1AB;

  --radius:     14px;
  --radius-sm:  8px;
  --touch:      44px;      /* minimum touch target */
  --page-width: 1200px;
  --gutter:     16px;
  /* Keep content clear of the iPhone notch / home bar and Android cutouts. */
  --safe-left:  max(var(--gutter), env(safe-area-inset-left));
  --safe-right: max(var(--gutter), env(safe-area-inset-right));

  --font-ui:    "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-num:   "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- Base ---------- */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-ui); font-size: 15px; line-height: 1.5; background: var(--bg); color: var(--text); -webkit-tap-highlight-color: transparent; }
a, button, input, select, textarea, label { touch-action: manipulation; }
/* 16px minimum stops iPhone Safari from zooming in when a field is tapped. */
input, select, textarea { font-size: max(16px, 1em); }
:focus-visible { outline: 2px solid var(--purple-600); outline-offset: 2px; }
a { color: var(--purple-700); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
.muted { color: var(--muted); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* ---------- App shell: left menu + main area ---------- */
:root { --sidebar-width: 268px; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--purple-900); color: #fff; padding: calc(14px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: var(--touch); padding: 0 6px; color: #fff; text-decoration: none; font-weight: 700; }
.logo { width: 34px; height: 34px; border-radius: var(--radius-sm); background: #fff; flex: none; object-fit: contain; }
.sidenav { display: grid; gap: 6px; }
.navtile { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 10px; border-radius: 12px; color: #fff; text-decoration: none; border: 1px solid transparent; }
@media (hover: hover) { .navtile:hover { background: rgba(255,255,255,.07); } }
.navtile.active { background: rgba(255,255,255,.12); border-color: rgba(217,204,232,.35); }
.navtile-icon { width: 36px; height: 36px; border-radius: 9px; background: rgba(255,255,255,.1); color: var(--purple-100); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.navtile.active .navtile-icon { background: var(--purple-600); color: #fff; }
.navtile-icon svg { width: 20px; height: 20px; }
.navtile-text { display: grid; min-width: 0; flex: 1; }
.navtile-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navtile-sub { font-size: 12px; color: var(--purple-100); opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navtile.is-soon .navtile-name { opacity: .75; }
.navtile-metric { font-size: 15px; font-weight: 600; color: #fff; background: rgba(255,255,255,.12); border-radius: 999px; padding: 2px 9px; }
.sidebar-user { margin-top: auto; padding: 10px 2px 0; font-size: 13px; color: var(--purple-100); border-top: 1px solid rgba(255,255,255,.12); display: flex; align-items: center; gap: 8px; }
.sidebar-user-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18); color: #fff !important; text-decoration: none !important; font-weight: 600; font-size: 13px; flex: none; }
.settings-button svg { width: 18px; height: 18px; }
@media (hover: hover) { .settings-button:hover { background: rgba(255,255,255,.08); } }
.settings-button.active, .settings-button.pressed, .settings-button:active { background: rgba(255,255,255,.16); border-color: rgba(217,204,232,.5); }
.scrim { display: none; }

.topbar { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--border); padding-top: env(safe-area-inset-top); }
.topbar-inner { max-width: var(--page-width); margin: 0 auto; padding: 0 var(--safe-right) 0 var(--safe-left); min-height: 56px; display: flex; align-items: center; gap: 10px; }
.topbar-title { font-weight: 800; font-size: 18px; }
.menu-button { display: none; width: var(--touch); height: var(--touch); align-items: center; justify-content: center; border-radius: 10px; color: var(--purple-900); cursor: pointer; margin-left: -8px; }

/* Phones and small tablets: the menu slides in from the left. */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: min(86vw, 300px); height: auto; transform: translateX(-100%); transition: transform .2s ease, box-shadow .2s ease; box-shadow: none; }
  .nav-toggle:checked ~ .shell .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .nav-toggle:checked ~ .shell .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(28,23,38,.45); }
  .menu-button { display: inline-flex; }
  .topbar { background: var(--purple-900); color: #fff; border-bottom: 0; }
  .menu-button { color: #fff; }
}

/* ---------- Page ---------- */
.page { max-width: var(--page-width); margin: 0 auto; padding: 20px var(--safe-right) calc(48px + env(safe-area-inset-bottom)) var(--safe-left); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }

/* ---------- Common components ---------- */
.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--purple-50); color: var(--purple-700); white-space: nowrap; }
.chip.warn { background: var(--warn-bg); color: var(--warn-text); }
.chip.good { background: var(--good-bg); color: var(--good-text); }
.chip.active { background: var(--purple-600); color: #fff; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: var(--touch); padding: 0 18px; border-radius: 999px; border: 0; background: var(--purple-600); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
@media (hover: hover) { .button:hover { background: var(--purple-700); } }
.button:active { background: var(--purple-700); }
.button.secondary { background: var(--card); color: var(--purple-700); border: 1px solid var(--border); }

/* Tables live inside a card and scroll sideways on small screens. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; }

.empty-state { max-width: 560px; margin: 24px auto; padding: 32px; display: grid; gap: 12px; justify-items: start; }
.empty-state p { margin: 0; }

@media (max-width: 520px) {
  h1 { font-size: 24px; }
  .page { padding-top: 16px; }
}

/* ---------- Module pages: views and filters ---------- */
.module-head { display: grid; gap: 12px; margin-bottom: 12px; }
.pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: var(--touch); padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
.pill.active { background: var(--purple-600); border-color: var(--purple-600); color: #fff; }
.pill-count { font-size: 12px; opacity: .75; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input[type=search], .filters select { min-height: var(--touch); padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--text); font-family: inherit; }
.filters input[type=search] { flex: 1 1 220px; }
.filters select { flex: 0 1 200px; max-width: 100%; }
.link-button { display: inline-flex; align-items: center; min-height: var(--touch); padding: 0 8px; }
button.link-button { background: none; border: 0; font: inherit; color: var(--purple-700); cursor: pointer; text-decoration: underline; }
.list-meta { font-size: 13px; margin: 4px 0 12px; }
.small { font-size: 12px; }
.tag { display: inline-flex; padding: 2px 8px; border-radius: 6px; font-size: 12px; color: var(--muted); background: var(--bg); border: 1px solid var(--border); white-space: nowrap; }
.notice { padding: 16px 18px; margin-bottom: 16px; }
.notice p { margin: 4px 0 0; }
.notice.warn { background: var(--warn-bg); border-color: #F5C9A4; color: var(--warn-text); }
.notice-inline.warn { color: var(--warn-text); margin: 0; }
.neg { color: var(--warn-text); }
/* Billed that includes retention held back (earned, not collected yet). */
.retention, .detail-grid dd.fig-note.retention { color: #C2410C; }

/* ---------- Progress ring and bars ---------- */
.ring { position: relative; display: inline-flex; width: 48px; height: 48px; flex: none; }
.ring-track { fill: none; stroke: var(--purple-50); stroke-width: 5; }
.ring-fill { fill: none; stroke: var(--purple-600); stroke-width: 5; stroke-linecap: round; }
.ring.over .ring-fill { stroke: var(--warn-text); }
.ring.empty .ring-fill { stroke: none; }
.ring-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; }
.bar { display: inline-block; width: 80px; height: 6px; border-radius: 3px; background: var(--purple-50); overflow: hidden; vertical-align: middle; }
.bar > span { display: block; height: 100%; background: var(--purple-600); }
.bar.over > span { background: var(--warn-text); }

/* ---------- Expandable job rows ---------- */
/* Main line: ring · name + type · billed · profit pill. Everything else is in the dropdown. */
.job-list { display: grid; gap: 8px; min-width: 0; }
.job-section { font-size: 15px; margin: 20px 0 8px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.job-section:first-of-type { margin-top: 4px; }
.job { min-width: 0; }
.job > summary { list-style: none; cursor: pointer; }
.job > summary::-webkit-details-marker { display: none; }
.job-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: 14px; align-items: center; padding: 10px 14px; min-height: 68px; }
.job-row > * { min-width: 0; }
.job[open] > .job-row { border-bottom: 1px solid var(--border); }
@media (hover: hover) { .job > summary:hover { background: #FBFAFD; border-radius: var(--radius); } }
.job-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-num { color: var(--muted); font-weight: 500; font-size: 13px; }
.job-sub { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-pm { color: var(--text); }
.job-sub .pm-tag { margin-left: 6px; vertical-align: 1px; }
.attention-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn-text); margin-left: 6px; vertical-align: 2px; }
.job-contract { font-size: 13px; color: var(--text); margin-top: 1px; }
.job-line-figs { display: grid; grid-template-columns: auto auto; gap: 2px 10px; margin: 0; align-items: baseline; }
.job-line-figs > div { display: contents; }
.job-line-figs dt { font-size: 12px; color: var(--muted); text-align: right; }
.job-line-figs dd { margin: 0; font-size: 14px; text-align: right; white-space: nowrap; }
.profit { justify-self: end; min-width: 64px; text-align: center; font-size: 18px; font-weight: 600; padding: 4px 12px; border-radius: 999px; }
.chevron { width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: 0 4px 4px; transition: transform .15s; }
.job[open] .chevron { transform: rotate(-135deg); margin-top: 6px; }

.job-detail { padding: 14px 16px 16px; display: grid; gap: 14px; }
.job-detail > * { min-width: 0; }
.job-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 20px; margin: 0; }
.detail-grid.money { padding-top: 12px; border-top: 1px solid var(--border); }
.detail-grid dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.detail-grid dd { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.detail-grid dd.num { font-size: 15px; }
.detail-grid dd.fig-note { font-size: 12px; color: var(--muted); margin-top: 1px; }
.job-links { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.job-tabs-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.job-panel { display: grid; gap: 14px; }
.job-panel[hidden] { display: none; }
.detail-title { font-size: 15px; margin: 4px 0 8px; }
.crew { margin-bottom: 8px; }
.crew-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; }
.crew-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.crew-name { font-weight: 600; }
.crew-meta { font-size: 12px; color: var(--muted); width: 100%; }
.job-detail .table-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.data tfoot td { font-weight: 700; border-top: 1px solid var(--border); }
table.data tr.no-costs td { color: var(--muted); }
table.data td.used { white-space: nowrap; }
table.data td.used .bar { width: 60px; margin-right: 6px; }

@media (max-width: 640px) {
  /* Phones: ring · name/type · profit. Billed moves under the name. */
  .job-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 10px 12px; }
  .job-row > .ring { grid-row: 1 / span 2; align-self: start; }
  .job-line-figs { grid-column: 2; grid-row: 2; display: flex; gap: 14px; }
  .job-line-figs > div { display: flex; gap: 4px; align-items: baseline; }
  .job-row .chevron { display: none; }
  .profit { grid-column: 3; grid-row: 1 / span 2; font-size: 16px; min-width: 56px; padding: 4px 10px; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Scheduling ---------- */
/* Each job has its own hue (--h, set inline per job). Light tint fill, strong edge, dark text. */
.block, .agenda-item { --jc-bg: hsl(var(--h, 270) 75% var(--l, 92%)); --jc-fg: hsl(var(--h, 270) 60% 18%); --jc-edge: hsl(var(--h, 270) 62% 42%); }
.swatch { background: hsl(var(--h, 270) 62% 42%); }

/* Crew levels, so balanced crews are easy to see. */
.pchip { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
/* One green scale: darker = more senior. */
.pchip.lvl-foreman { background: #14532D; color: #fff; }
.pchip.lvl-painter { background: #22A35A; color: #fff; }
.pchip.lvl-helper { background: #BBF7D0; color: #14532D; border-color: #86EFAC; }
.pchip.lvl-supervisor { background: #E7E5EB; color: #3F3A47; }
/* Management: purple by role (PMs use their own PM color inline). */
.pchip.lvl-admin { background: #3B0764; color: #fff; }
.pchip.lvl-office { background: #8B5CF6; color: #fff; }
.pchip.lvl-sales { background: #EDE4FF; color: #4C1D95; border-color: #D3BFFF; }
.pchips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.block-time { font-size: 11.5px; opacity: .8; }
.pm-tag { display: inline-flex; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.day-cost { font-size: 12px; font-weight: 600; color: var(--text); padding: 2px 2px 0; }
.day-cost.est { color: var(--muted); font-weight: 500; }
.row-cost { display: block; font-size: 12px; font-weight: 600; margin-top: 3px; }

.schedule-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.schedule-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.schedule-title { font-size: 20px; margin-left: 6px; }
.button.icon { width: var(--touch); padding: 0; font-size: 22px; line-height: 1; }
.schedule-toggles { display: flex; gap: 8px; flex-wrap: wrap; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; background: var(--card); padding: 3px; }
.segmented a, .segmented span, .segmented button { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--text); text-decoration: none; }
.segmented a.active, .segmented button.active { background: var(--purple-600); color: #fff; }
.segmented button { border: 0; background: none; font-family: inherit; cursor: pointer; }
.segmented .disabled { color: var(--muted); opacity: .6; cursor: default; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }

.schedule-grid-card { overflow: hidden; }
.schedule-grid { border-collapse: collapse; width: 100%; min-width: 760px; table-layout: fixed; font-size: 13px; }
.schedule-grid th, .schedule-grid td { border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); padding: 6px; vertical-align: top; text-align: left; }
.schedule-grid thead th { font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 8px; background: #FBFAFD; }
.schedule-grid .row-head { width: 200px; border-left: 0; font-weight: 600; }
.schedule-grid tbody .row-head { display: table-cell; }
.schedule-grid .row-head .swatch { vertical-align: -2px; margin-right: 6px; }
.row-title { overflow-wrap: anywhere; }
.row-sub { display: block; font-weight: 400; font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-grid .today { background: #FAF7FD; }
.schedule-grid thead th.today { color: var(--purple-600); }
.schedule-grid tr:last-child > * { border-bottom: 0; }
.block { display: grid; gap: 1px; padding: 5px 7px; margin-bottom: 4px; border-radius: 6px; background: var(--jc-bg); color: var(--jc-fg); border-left: 3px solid var(--jc-edge); }
.block-title { font-weight: 600; overflow-wrap: anywhere; }
.block-sub { font-size: 12px; opacity: .85; overflow-wrap: anywhere; }
.block.done, .agenda-item.done { opacity: .55; }

.agenda { display: none; gap: 18px; }
.agenda.always { display: grid; }
.agenda-day h2 { font-size: 15px; margin: 0 0 8px; }
.agenda-day h2.today { color: var(--purple-600); }
.agenda-item { padding: 12px 14px; margin-bottom: 8px; border-left: 5px solid var(--jc-edge); display: grid; gap: 3px; }
.agenda-top { display: flex; justify-content: space-between; gap: 8px; }
.agenda-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.agenda-task { font-size: 14px; }
.agenda-people { font-size: 13px; color: var(--muted); }
.agenda-address { font-size: 13px; display: inline-flex; min-height: 32px; align-items: center; }

@media (max-width: 760px) {
  .schedule-grid-card { display: none; }
  .agenda { display: grid; }
  .schedule-head { align-items: flex-start; }
  .schedule-title { width: 100%; margin: 4px 0 0; font-size: 18px; order: 5; }
}

/* ---------- Schedule: month view (read only) ---------- */
.month-job, .month-day-job { --jc-bg: hsl(var(--h, 270) 75% var(--l, 92%)); --jc-fg: hsl(var(--h, 270) 60% 18%); --jc-edge: hsl(var(--h, 270) 62% 42%); }
.month-card { overflow: hidden; }
.month-grid { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: 12.5px; }
.month-grid thead th { font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; background: #FBFAFD; text-align: left; border-bottom: 1px solid var(--border); }
.month-cell { position: relative; height: 128px; padding: 4px 5px 6px; vertical-align: top; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); }
.month-cell:first-child { border-left: 0; }
.month-grid tr:last-child .month-cell { border-bottom: 0; }
.month-cell.other-month { background: #FBFAFD; }
.month-cell.other-month .month-num { color: var(--muted); opacity: .7; }
.month-cell.today { background: #FAF7FD; }
.month-date { display: flex; min-height: 26px; align-items: center; color: var(--text); text-decoration: none; font-weight: 700; }
.month-num { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 999px; }
@media (hover: hover) { .month-date:hover .month-num { background: var(--purple-50); color: var(--purple-700); } }
.month-cell.today .month-num { background: var(--purple-600); color: #fff; }
.month-jobs { display: grid; gap: 3px; }
.month-job { display: block; padding: 2px 6px; border-radius: 5px; background: var(--jc-bg); color: var(--jc-fg); border-left: 3px solid var(--jc-edge); font-weight: 600; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (hover: hover) { .month-job:hover { text-decoration: underline; } }
.month-job.done { opacity: .55; }
.month-more { font-size: 12px; font-weight: 600; color: var(--purple-700); text-decoration: none; padding: 0 2px; }
.month-dots { display: none; }
.month-count { font-size: 11px; font-weight: 700; color: var(--muted); line-height: 1; }
.month-days { display: none; }

@media (max-width: 760px) {
  /* Phones: each day is a tap target with a dot per job; the tapped day's jobs list under the grid. */
  .month-grid thead th { padding: 6px 0; text-align: center; font-size: 11px; }
  .month-cell { height: 58px; padding: 3px 2px; text-align: center; }
  .month-date { justify-content: center; min-height: 24px; }
  .month-date::after { content: ""; position: absolute; inset: 0; }
  .month-jobs { display: none; }
  .month-dots { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 3px; padding: 2px 1px 0; }
  .month-dots .swatch { width: 8px; height: 8px; border-radius: 50%; }
  .month-cell.selected { box-shadow: inset 0 0 0 2px var(--purple-600); }
  .month-days { display: block; margin-top: 16px; }
  .month-day { display: none; }
  .month-day.selected { display: block; }
}
.month-day h2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; margin: 0 0 8px; }
.month-day h2.today { color: var(--purple-600); }
.month-open { display: inline-flex; align-items: center; min-height: var(--touch); font-size: 14px; font-weight: 600; text-decoration: none; }
.month-day-job { display: grid; gap: 4px; padding: 12px 14px; margin-bottom: 8px; border-left: 5px solid var(--jc-edge); color: var(--text); text-decoration: none; }
.month-day-job.done { opacity: .55; }
.month-day-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.month-day-job .block-title { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.month-day-tasks { font-size: 13px; overflow-wrap: anywhere; }

/* ---------- Schedule: what actually happened (past days) ---------- */
.pchip.no-show { text-decoration: line-through; opacity: .55; }
.pchip.unscheduled { outline: 2px dashed currentColor; outline-offset: -2px; }
.pchip .hrs { font-weight: 500; opacity: .85; margin-left: 3px; }
.actual { margin: 2px 0 4px; padding: 4px 6px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }
.actual-label { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* ---------- Schedule editor ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.editor-toolbar select { max-width: 260px; min-height: var(--touch); padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--purple-700); font: inherit; font-weight: 600; }
.edit-pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--warn-bg); color: #C2410C; }
.editor-help { font-size: 13px; margin: 0 0 10px; max-width: 90ch; }
.select-hint { position: sticky; top: 64px; z-index: 6; margin-bottom: 8px; padding: 8px 12px; border-radius: 10px; background: var(--purple-900); color: #fff; font-size: 14px; }
.select-hint .link-button { color: #fff; }
.editor-grid { min-width: 980px; }
.editor-grid td.drop { min-height: 70px; position: relative; }
.editor-grid td.over, .block.over { outline: 2px dashed var(--purple-600); outline-offset: -3px; background: var(--purple-50); }
.block.editable { cursor: grab; position: relative; }
.block.is-changed { box-shadow: 0 0 0 2px #C2410C; }
.block.is-new { box-shadow: 0 0 0 2px #15803D; outline: 1px dashed #15803D; }
.block.targetable { box-shadow: 0 0 0 2px var(--purple-600); }
.edit-tag { position: absolute; top: -8px; right: 6px; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: #C2410C; color: #fff; }
.edit-tag.new { background: #15803D; }
.editor-grid .pchip { cursor: grab; }
.pchip.selected { outline: 3px solid var(--purple-900); outline-offset: 1px; }
.add-day { display: none; width: 100%; margin-top: 4px; font: inherit; font-size: 12px; color: var(--muted); border: 1px dashed var(--border); background: none; border-radius: 6px; padding: 6px; cursor: pointer; min-height: 32px; }
.editor-grid td.drop:hover .add-day { display: block; }
@media (hover: none) { .editor-grid .add-day { display: block; } }
.editor-grid tr.free-row th, .editor-grid tr.free-row td { background: var(--bg); }
.editor-grid td.free.targetable { box-shadow: inset 0 0 0 2px var(--purple-600); }
.pending-bar { position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 7; margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: 14px; background: var(--purple-900); color: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.pending-bar.empty { opacity: .85; }
.pending-bar .button.secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.pending-bar .button:not(.secondary) { background: #fff; color: var(--purple-900); }
.pending-bar .button[disabled] { opacity: .5; cursor: default; }
.pending-actions { display: flex; gap: 8px; }
.button.danger { background: var(--card); color: #B91C1C; border: 1px solid #F0C4C4; }

.drawer-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(28,23,38,.4); }
.drawer, .review-modal { position: fixed; z-index: 41; overflow-y: auto; padding: 18px; display: grid; gap: 12px; align-content: start; }
.drawer { top: 0; right: 0; bottom: 0; width: min(440px, 100vw); border-radius: 0; padding-top: calc(18px + env(safe-area-inset-top)); padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
.review-modal { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
.drawer h2, .review-modal h2 { margin: 0; font-size: 18px; }
.drawer form { display: grid; gap: 12px; }
.field { display: grid; gap: 4px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select { min-height: var(--touch); padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.crew-picker { display: grid; gap: 8px; max-height: 280px; overflow-y: auto; padding: 6px; border: 1px solid var(--border); border-radius: 10px; }
.crew-group { border: 0; margin: 0; padding: 0; display: grid; gap: 2px; }
.crew-group legend { margin-bottom: 4px; }
.crew-check { display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 14px; }
.crew-check input { width: 20px; height: 20px; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.review-item { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); font-size: 13.5px; }
.review-item b { font-size: 14px; }
.review-item.create { border-color: #86C69B; background: #F0F8F2; }
.review-item.delete { border-color: #F0C4C4; background: #FDF1F1; }
.review-item.result-done { border-color: #86C69B; }
.review-item.result-conflict, .review-item.result-failed { border-color: #F0C4C4; background: #FDF1F1; }
.notice-inline { font-size: 13px; color: #C2410C; margin: 0; }
@media (max-width: 760px) {
  /* The editor keeps the week grid on phones (it scrolls sideways inside its card). */
  #schedule-editor .schedule-grid-card { display: block; }
}

/* Day view: one card per job, most people first. */
.agenda-job { padding: 12px 14px; margin-bottom: 10px; border-left: 5px solid hsl(var(--h, 270) 62% 42%); display: grid; gap: 6px; }
.agenda-job .block-title { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; }
.agenda-meta { display: inline-flex; gap: 8px; align-items: center; }
.agenda-count { font-size: 13px; font-weight: 500; }
.agenda-task-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 2px 10px; align-items: baseline; padding-top: 6px; border-top: 1px solid var(--border); }
.agenda-task-row .pchips { grid-column: 2; }
.agenda-task-row.done { opacity: .55; }
@media (max-width: 520px) { .agenda-task-row { grid-template-columns: minmax(0, 1fr); } .agenda-task-row .pchips { grid-column: 1; } }
.row-head .pchip { text-transform: capitalize; margin-left: 4px; }

/* Tasks marked for deletion (renamed DELETE, moved to Sunday): delete them in JobTread. */
.block.marked-delete { background: #FDF1F1; color: #7F1D1D; border-left-color: #B91C1C; }
.block.marked-delete .block-title { text-decoration: line-through; }

/* Employees */
.section-title { font-size: 15px; margin: 18px 0 8px; }
.section-title .muted { font-weight: 500; margin-left: 4px; }
.emp-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 14px; min-height: 56px; cursor: pointer; list-style: none; }
.emp-row::-webkit-details-marker { display: none; }
.emp-row > * { min-width: 0; }
.emp[open] > .emp-row { border-bottom: 1px solid var(--border); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; background: #E7E5EB; color: #3F3A47; }
.avatar.lvl-foreman { background: #14532D; color: #fff; }
.avatar.lvl-painter { background: #22A35A; color: #fff; }
.avatar.lvl-helper { background: #BBF7D0; color: #14532D; }
.avatar.lvl-admin { background: #3B0764; color: #fff; }
.avatar.lvl-office { background: #8B5CF6; color: #fff; }
.avatar.lvl-sales { background: #EDE4FF; color: #4C1D95; }
.emp-figs { display: flex; align-items: center; gap: 8px; }
.emp-hours { min-width: 56px; text-align: right; font-size: 13px; }
.emp-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small-chip { font-size: 11px; padding: 1px 7px; margin-left: 6px; }
.emp-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; padding: 12px 14px 14px; }
.emp-form fieldset { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.emp-form fieldset[disabled] { opacity: .6; }
.emp-form .field { display: grid; gap: 4px; align-content: start; }
.emp-form .field > span { font-size: 12px; font-weight: 600; color: var(--muted, #6B6475); }
.emp-form .wide { grid-column: 1 / -1; }
.emp-form select, .emp-form textarea { width: 100%; font: inherit; }
.emp-form input[type=color] { width: 48px; height: 32px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; }
.color-row { display: flex; align-items: center; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.emp-jobs .crew-list { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 760px) {
  .emp-detail { grid-template-columns: minmax(0, 1fr); padding: 10px 12px; }
  .emp-form fieldset { grid-template-columns: minmax(0, 1fr); }
  .emp-row { grid-template-columns: auto minmax(0, 1fr) auto; padding: 8px 12px; }
  .emp-row .chevron { display: none; }
  .emp-figs .pm-tag { display: none; }
}
.emp .job-sub { white-space: normal; overflow: visible; }
.row-pm { display: block; margin-top: 3px; }
.task-pick { max-height: 50vh; overflow-y: auto; }
.task-option { width: 100%; display: grid; gap: 2px; text-align: left; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface, #fff); font: inherit; cursor: pointer; }
.task-option:hover, .task-option:focus-visible { border-color: var(--purple-600); }
.emp-rates { display: grid; justify-items: end; font-size: 12px; line-height: 1.3; min-width: 92px; }
.emp-rates-inline { display: none; }
@media (max-width: 760px) { .emp-rates { display: none; } .emp-rates-inline { display: inline; } }

/* Connections */
.connections { display: grid; gap: 12px; max-width: 760px; }
.connection { padding: 16px 18px; display: grid; gap: 10px; }
.connection-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.connection-head h2 { margin: 0; font-size: 17px; }
.connection .form-actions form { display: inline; }
.sidebar-user a { color: inherit; text-decoration: underline; }
.link-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.link-form .field { display: grid; gap: 4px; flex: 1 1 260px; }
.link-form .field > span { font-size: 12px; font-weight: 600; }
.link-form input { width: 100%; font: inherit; }
.paste-key { margin-top: 4px; } .paste-key > summary { cursor: pointer; } .paste-key .link-form { margin-top: 8px; }

/* Financials */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpi { padding: 14px 16px; display: grid; gap: 2px; min-width: 0; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 24px; font-weight: 700; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.fin-section { padding: 14px 16px; margin-bottom: 12px; min-width: 0; }
.fin-section .section-title { margin-top: 0; }
table.data tr.total td { font-weight: 700; border-top: 2px solid var(--border); }
table.data tr.burden-row td:first-child { padding-left: 24px; }
.flags { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.flag { display: grid; gap: 2px; padding: 10px 12px; border-radius: 8px; border-left: 4px solid var(--purple-600); background: var(--purple-50); font-size: 14px; }
.flag.warn { border-left-color: #D97706; background: var(--warn-bg); }
.flag span { color: var(--muted); }
.acct-list summary { cursor: pointer; }
.acct-list ul { list-style: none; margin: 6px 0 0; padding: 0 0 0 12px; display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.acct-list li { display: flex; justify-content: space-between; gap: 12px; }
.fin-section .bar { display: inline-block; height: 6px; width: calc(var(--w) * 0.6); max-width: 60px; background: var(--purple-600); border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.bonus-detail { padding: 12px 14px; display: grid; gap: 10px; } .bonus-detail .form-actions form { display: inline; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-top: 8px; }
.inline-form input, .inline-form select { font: inherit; }
.inline-form .field { display: grid; gap: 4px; }
.inline-form .field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.inline-form .field.grow { flex: 1 1 200px; }
.inline-form .field.grow input { width: 100%; }
.fin-section form { display: inline; }
.fin-section .inline-form { display: flex; }
.emp-row.with-chip { grid-template-columns: auto minmax(0, 1fr) auto auto auto; }
@media (max-width: 760px) { .emp-row.with-chip { grid-template-columns: auto minmax(0, 1fr) auto; } .emp-row.with-chip .emp-rates { display: none; } }
.chip.bad { background: #FEE2E2; color: #991B1B; }
.cust-job { border-top: 1px solid var(--border); padding-top: 10px; display: grid; gap: 4px; }
.cust-job-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.cust-links { margin-left: auto; display: flex; gap: 4px; }
.cust-review { border: 1px solid var(--border); border-radius: 10px; background: var(--purple-50); padding: 10px 12px; }
.cust-review-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.cust-review .inline-form select, .cust-review .inline-form input { min-height: 44px; }
.cust-review-chip { margin-left: 8px; vertical-align: 1px; }
@media (max-width: 760px) { .cust-review .inline-form .field.grow { flex-basis: 100%; } }
.connection-head { flex-wrap: wrap; } .connection-head h2 { margin-right: auto; }

/* Job timeline */
.timeline-title { margin: 4px 0 2px; font-size: 20px; }
.timeline-card { padding: 12px 14px; }
.timeline { min-width: 820px; display: grid; }
.tl-head, .tl-row { display: grid; grid-template-columns: 260px minmax(0, 1fr); align-items: center; min-height: 34px; }
.tl-head { min-height: 38px; border-bottom: 1px solid var(--border); }
.tl-row { border-bottom: 1px dashed color-mix(in srgb, var(--border) 70%, transparent); }
.tl-phase { background: var(--purple-50); }
.tl-label { padding: 4px 10px 4px 0; display: grid; min-width: 0; }
.tl-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.tl-track { position: relative; height: 100%; min-height: 30px; }
.tl-week { position: absolute; top: 4px; font-size: 11px; color: var(--muted); border-left: 1px solid var(--border); padding-left: 4px; }
.tl-today-label { position: absolute; top: 20px; font-size: 11px; font-weight: 700; color: #DC2626; transform: translateX(-50%); }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #DC2626; opacity: .55; }
.tl-bar { position: absolute; top: 8px; height: 16px; border-radius: 4px; background: var(--purple-600); }
.tl-bar.phase { top: 11px; height: 10px; background: var(--purple-900, #3B0764); opacity: .55; }
.tl-bar.done { background: #22A35A; }
.tl-bar.now { background: #D97706; }
.tl-bar.late { background: #DC2626; }
.tl-crew { position: absolute; top: 6px; display: flex; gap: 3px; padding-left: 6px; white-space: nowrap; align-items: center; }
.tl-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tl-key { display: inline-block; width: 18px; height: 8px; border-radius: 3px; background: var(--purple-600); margin-left: 8px; }
.tl-key.done { background: #22A35A; } .tl-key.now { background: #D97706; } .tl-key.late { background: #DC2626; }
a.row-title, a.block-title { color: inherit; text-decoration: none; } a.row-title:hover, a.block-title:hover { text-decoration: underline; }
table.data tr.row-off td { background: color-mix(in srgb, var(--warn-bg) 60%, transparent); }

/* Navigation feedback (nav-feedback.js) */
.pill { cursor: pointer; transition: background-color .12s, border-color .12s, color .12s; }
.pill:hover { border-color: var(--purple-600); }
.pill.pressed, .segmented a.pressed { background: var(--purple-600); border-color: var(--purple-600); color: #fff; }
.button.pressed, button.pressed { filter: brightness(.88); }
.button.secondary.pressed, .button.danger.pressed { background: var(--purple-50); }
button.link-button.pressed, a.pressed:not(.pill):not(.navtile):not(.button) { opacity: .6; }
.navtile.pressed { background: rgba(255,255,255,.16); border-color: rgba(217,204,232,.5); }
.navtile.pressed .navtile-icon { background: var(--purple-600); color: #fff; }
/* Instant tactile response on press, before the click even fires. */
.navtile:active { background: rgba(255,255,255,.14); }
.pill:active, .segmented a:active { filter: brightness(.94); }
.button, .pill, .navtile, .segmented a, button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.nav-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--purple-600); z-index: 100; opacity: 0; pointer-events: none; }
body.navigating .nav-progress { opacity: 1; animation: nav-progress 8s cubic-bezier(.1, .7, .2, 1) forwards; }
body.navigating .page { opacity: .6; transition: opacity .2s .15s; pointer-events: none; }
body.navigating { cursor: progress; }
@keyframes nav-progress { from { width: 0; } 10% { width: 35%; } to { width: 92%; } }
@media (prefers-reduced-motion: reduce) { body.navigating .nav-progress { animation: none; width: 60%; } }
/* Background data loading: the page shows the copy from before a JobTread change while the new one loads
   (nav-feedback.js). The same bar runs full width and pulses slowly, and a note sits next to the title. */
body.refreshing:not(.navigating) .nav-progress { opacity: 1; width: 100%; animation: data-refresh 1.4s ease-in-out infinite alternate; }
@keyframes data-refresh { from { opacity: .25; } to { opacity: .9; } }
@media (prefers-reduced-motion: reduce) { body.refreshing:not(.navigating) .nav-progress { animation: none; opacity: .6; } }
.data-updating { font-size: 13px; color: var(--muted); margin-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.data-updating a { color: var(--purple-600); font-weight: 700; }
@media (max-width: 640px) { .data-updating { display: none; } body.refreshing .data-updating.done { display: inline; } }

/* Refresh: a small button next to "loaded at" lines. */
.refresh-button { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 12px; margin: 2px 0; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--purple-700); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; vertical-align: middle; }
@media (hover: hover) { .refresh-button:hover { border-color: var(--purple-600); } }
.refresh-button:active, .refresh-button.pressed { background: var(--purple-50); }

/* ---------- Hiring (Employees → Hiring) ---------- */
.hire-stages { margin-bottom: 10px; }
.hire-add { margin-bottom: 12px; }
.hire-add > summary { list-style: none; cursor: pointer; }
.hire-add > summary::-webkit-details-marker { display: none; }
.hire-add-summary { display: flex; align-items: center; gap: 10px; min-height: var(--touch); padding: 6px 14px; font-weight: 700; color: var(--purple-700); }
.hire-plus { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--purple-600); color: #fff; font-size: 18px; line-height: 1; }
.hire-add[open] .hire-add-summary { border-bottom: 1px solid var(--border); }
.hire-add-form { padding: 4px 14px 14px; }
.inline-form .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .inline-form .field select { width: 100%; }
.field textarea { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; resize: vertical; width: 100%; }
.field input[type=file] { min-height: var(--touch); padding: 8px 10px; max-width: 100%; }

.hire-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; min-height: 64px; color: inherit; text-decoration: none; }
.hire-row > * { min-width: 0; }
@media (hover: hover) { .hire-row:hover { border-color: var(--purple-600); } }
.hire-row .job-main { display: grid; }
.hire-row .job-sub { display: block; }
.hire-exp { font-size: 12px; }
.hire-avatar { flex: none; }
.avatar.lang-en { background: var(--purple-50); color: var(--purple-700); }
.avatar.lang-es { background: #FCE7D6; color: #9A3412; }
.avatar.lang-both { background: linear-gradient(135deg, var(--purple-50) 50%, #FCE7D6 50%); color: var(--purple-900); }
.hire-row-right { display: grid; justify-items: end; gap: 3px; text-align: right; }
.hire-when { white-space: nowrap; }
.hire-stars { color: #B45309; letter-spacing: 1px; font-size: 14px; white-space: nowrap; }
.hire-date-badge { width: 48px; height: 52px; border-radius: 10px; border: 1px solid var(--border); background: var(--purple-50); display: inline-grid; place-items: center; align-content: center; line-height: 1.05; color: var(--purple-700); flex: none; }
.hire-date-badge span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.hire-date-badge b { font-size: 20px; font-weight: 800; }
.hire-date-badge.today { background: var(--purple-600); border-color: var(--purple-600); color: #fff; }

.hire-docs { margin-top: 16px; }
.hire-doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hire-doc-list li { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; padding: 4px 0; }
.hire-doc-list a { font-weight: 600; }

.hire-texts { display: grid; gap: 8px; }
.hire-texts-head { margin: 0; }
.hire-text { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: #FCFBFE; display: grid; gap: 4px; }
.hire-text-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hire-text-body { margin: 0; white-space: pre-wrap; font-size: 14px; overflow-wrap: anywhere; }
.button.small-button { min-height: 36px; padding: 0 14px; font-size: 13px; }
.button.copied { background: var(--good-bg); color: var(--good-text); border-color: #A7D3B5; }
@media (pointer: coarse) { .button.small-button { min-height: var(--touch); } }

.hire-h1 { font-size: 22px; font-weight: 800; overflow-wrap: anywhere; }
.hire-day-head { padding: 14px 16px; display: grid; gap: 10px; margin-bottom: 12px; }
.hire-day-title { display: flex; gap: 12px; align-items: flex-start; }
.hire-map { display: inline-flex; min-height: 32px; align-items: center; font-size: 14px; }
.hire-day-stats { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hire-hint { margin: 0; max-width: 90ch; }
.hire-slots { margin-bottom: 12px; }
.hire-booking { padding: 10px 14px; display: grid; gap: 8px; position: relative; scroll-margin-top: 72px; }
.hire-booking.flagged { border-color: #F5C9A4; background: #FFFBF7; }
.anchor { position: absolute; top: -72px; }
.hire-booking-top { display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.hire-booking-top > * { min-width: 0; }
.hire-booking .job-title { display: block; color: inherit; text-decoration: none; }
.hire-booking .job-sub { white-space: normal; }
.hire-time { font-weight: 600; font-size: 14px; white-space: nowrap; }
.hire-booking-chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; align-items: center; }
.hire-checks { display: flex; flex-wrap: wrap; gap: 4px 18px; padding-left: 88px; }
.hire-checks form { display: inline; }
.hire-check { display: inline-flex; align-items: center; gap: 8px; min-height: var(--touch); font-size: 14px; cursor: pointer; }
.hire-check input { width: 22px; height: 22px; accent-color: var(--purple-600); flex: none; }
.hire-check.big { display: flex; font-size: 15px; }
.hire-check.saving { opacity: .55; }
.hire-flag { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-text); }
.hire-flag form { display: inline; }
.hire-more > summary, .hire-open > summary { cursor: pointer; list-style: none; }
.hire-more > summary::-webkit-details-marker, .hire-open > summary::-webkit-details-marker { display: none; }
.hire-more > summary { display: inline-flex; align-items: center; min-height: 36px; font-size: 13px; font-weight: 600; color: var(--purple-700); }
.hire-more > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin: 0 0 3px 8px; }
.hire-more[open] > summary::after { transform: rotate(-135deg); margin: 4px 0 0 8px; }
.hire-more-body { display: grid; gap: 12px; padding-top: 4px; }
.hire-open { padding: 6px 14px; border-style: dashed; background: #FCFBFE; scroll-margin-top: 72px; }
.hire-open > summary { min-height: 44px; }
.hire-open[open] { border-style: solid; background: var(--card); padding-bottom: 14px; }
.hire-open-label { font-weight: 700; color: var(--good-text); }
.hire-book-link { font-size: 13px; font-weight: 700; color: var(--purple-700); padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); }
.hire-sheet-table td { white-space: nowrap; }
.hire-empty-row td { color: var(--muted); }
.hire-two-lang, .hire-two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }

.hire-head { padding: 14px 16px; display: grid; gap: 12px; margin-bottom: 12px; }
.hire-head-top { display: flex; gap: 12px; align-items: center; }
.hire-head-top .avatar { width: 48px; height: 48px; font-size: 16px; }
.hire-head-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.detail-grid .wide { grid-column: 1 / -1; }
.hire-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.hire-section-head .section-title { margin: 0; }
.hire-checklist-static { margin: 0 0 8px; padding-left: 18px; display: grid; gap: 2px; font-size: 14px; }
.hire-tools-level { display: flex; gap: 8px; align-items: baseline; margin-bottom: 6px; font-size: 14px; }
.hire-tools-level .pchip { flex: none; }
.hire-decide { margin-top: 12px; padding-top: 4px; border-top: 1px solid var(--border); }
.hire-onboarding-form { display: grid; gap: 0; }
.hire-onboarding-form p { margin: 8px 0 0; }
.hire-trial .section-title, .hire-onboarding .section-title { margin-bottom: 4px; }

.hire-file-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.hire-file { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.hire-thumb { width: 64px; height: 64px; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; display: grid; place-items: center; background: var(--bg); text-decoration: none; }
.hire-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hire-file-icon { font-size: 12px; font-weight: 800; color: var(--purple-700); letter-spacing: .04em; }
.hire-file-main { display: grid; gap: 2px; min-width: 0; }
.hire-file-name { font-weight: 600; overflow-wrap: anywhere; }
.hire-file-actions { display: flex; gap: 6px 14px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.hire-file-actions form { display: inline; }
.hire-file-actions .link-button { min-height: 32px; padding: 0; }
.hire-history { list-style: none; margin: 8px 0 0; padding: 0; display: grid; }
.hire-event { display: grid; gap: 1px; padding: 8px 0 8px 14px; border-left: 2px solid var(--border); position: relative; }
.hire-event::before { content: ""; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--purple-100); }
.hire-event.kind-stage::before { background: var(--purple-600); }
.hire-event.kind-note::before { background: #D97706; }
.hire-event-text { font-size: 14px; overflow-wrap: anywhere; }

/* Interview sheet: big touch targets for a phone or tablet. */
.sheet { padding: 16px; display: grid; gap: 14px; max-width: 820px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.sheet .field input { width: 100%; }
.sheet-q { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
.sheet-q legend { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 0; margin-bottom: 6px; }
.sheet-yn { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.choice { display: flex; flex-wrap: wrap; gap: 6px; }
.choice label { position: relative; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span { display: inline-flex; align-items: center; justify-content: center; min-height: var(--touch); min-width: 64px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-weight: 600; font-size: 15px; cursor: pointer; }
.choice.years span { min-width: 48px; padding: 0 10px; }
.choice input:checked + span { background: var(--purple-600); border-color: var(--purple-600); color: #fff; }
.choice input:focus-visible + span { outline: 2px solid var(--purple-600); outline-offset: 2px; }
.sheet-ours { border-top: 1px solid var(--border); padding-top: 14px; margin: 4px 0 0; }
.points .hire-check { min-height: 40px; }
.stars-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.stars-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars-input label { font-size: 34px; line-height: 1; color: #D6D0DF; cursor: pointer; padding: 2px 3px; min-width: var(--touch); text-align: center; }
.stars-input input:checked ~ label { color: #D97706; }
@media (hover: hover) { .stars-input label:hover, .stars-input label:hover ~ label { color: #F59E0B; } }
.stars-input input:focus-visible + label { outline: 2px solid var(--purple-600); border-radius: 6px; }
.sheet-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); background: var(--card); padding: 8px 0; }

@media (max-width: 640px) {
  .hire-row { padding: 10px 12px; gap: 10px; }
  .hire-two-lang, .hire-two-col { grid-template-columns: minmax(0, 1fr); }
  .hire-booking-top { grid-template-columns: 74px minmax(0, 1fr); }
  .hire-booking-chips { grid-column: 2; justify-content: flex-start; }
  .hire-checks { padding-left: 0; }
  .hire-open > summary.hire-booking-top { grid-template-columns: 74px minmax(0, 1fr) auto; }
  .hire-h1 { font-size: 20px; }
  .sheet { padding: 14px 12px; }
}
.hire-check.save-failed { color: #B91C1C; }
.hire-compact .hire-text-body { max-height: 4.6em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
/* ---------- Global search (top bar, search.js) ---------- */
/* Desktop: a field on the right of the top bar. Phones: an icon that opens a full-width box over the bar. */
.topbar-inner { position: relative; }
.search { position: relative; margin-left: auto; width: min(380px, 45%); display: flex; align-items: center; }
.search input { width: 100%; height: 40px; padding: 0 34px 0 36px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--text); font-family: inherit; font-size: 16px; }
.search input:focus { outline: none; border-color: var(--purple-600); box-shadow: 0 0 0 3px var(--purple-50); }
.search-icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search.loading .search-icon { color: var(--purple-600); animation: search-pulse .8s ease-in-out infinite alternate; }
@keyframes search-pulse { to { opacity: .35; } }
.search-key { position: absolute; right: 12px; min-width: 20px; padding: 0 5px; border: 1px solid var(--border); border-radius: 5px; font: 600 12px/18px var(--font-num); color: var(--muted); text-align: center; pointer-events: none; }
.search:focus-within .search-key, .search input:not(:placeholder-shown) ~ .search-key { display: none; }
@media (hover: none) { .search-key { display: none; } }
.search-open, .search-close { display: none; width: var(--touch); height: var(--touch); flex: none; align-items: center; justify-content: center; border: 0; border-radius: 10px; background: none; color: inherit; cursor: pointer; }

.search-results { position: absolute; z-index: 25; top: calc(100% + 6px); right: 0; width: max(100%, 460px); max-height: min(72vh, 600px); overflow-y: auto; overscroll-behavior: contain; padding: 4px 6px 6px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(28,23,38,.16); color: var(--text); }
.search-group + .search-group { border-top: 1px solid var(--border); margin-top: 4px; }
.search-group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 10px 10px 4px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.search-group-head a { font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.search-row { display: flex; align-items: stretch; min-width: 0; }
.search-option { flex: 1; min-width: 0; display: grid; align-content: center; min-height: var(--touch); padding: 5px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.search-option.active { background: var(--purple-50); }
.search-hit-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-hit-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-hit-title mark { background: none; color: var(--purple-700); font-weight: 800; }
.search-hit-ext { flex: none; display: inline-flex; align-items: center; padding: 0 10px; font-size: 12px; font-weight: 600; white-space: nowrap; text-decoration: none; border-radius: var(--radius-sm); }
@media (hover: hover) { .search-hit-ext:hover { background: var(--purple-50); } }
.search-empty, .search-note { margin: 0; padding: 12px 10px 6px; font-size: 14px; color: var(--muted); }
.search-note { font-size: 12px; padding-top: 6px; }
.search-all { margin-top: 4px; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-sm) var(--radius-sm); font-size: 14px; font-weight: 600; color: var(--purple-700); }

@media (max-width: 900px) {
  .search-open { display: inline-flex; margin: 0 -8px 0 auto; color: #fff; }
  .search { display: none; }
  body.search-active .search { display: flex; position: absolute; inset: 0; width: auto; gap: 4px; padding: 0 calc(var(--safe-right) - 8px) 0 var(--safe-left); background: var(--purple-900); }
  body.search-active .search-icon { left: calc(var(--safe-left) + 12px); }
  .search input { border-color: transparent; }
  .search-close { display: inline-flex; color: #fff; }
  /* Results fill the screen under the bar. */
  .search-results { position: fixed; top: calc(56px + env(safe-area-inset-top)); left: 0; right: 0; bottom: 0; width: auto; max-height: none; border: 0; border-radius: 0; box-shadow: none; padding: 4px max(10px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  .search-option { min-height: 52px; }
}

/* Full results page (/search) */
.search-page { display: grid; gap: 12px; }
.search-section { padding: 4px 16px 10px; min-width: 0; }
.search-section .section-title { margin: 12px 0 4px; }
.search-list { list-style: none; margin: 0; padding: 0; }
.search-hit { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); min-width: 0; }
.search-hit:last-child { border-bottom: 0; }
.search-hit-main { flex: 1; min-width: 0; display: grid; min-height: 52px; align-content: center; padding: 6px 0; color: var(--text); text-decoration: none; }
@media (hover: hover) { .search-hit-main:hover .search-hit-title { color: var(--purple-700); text-decoration: underline; } }
.search-hit-main .search-hit-title, .search-hit-main .search-hit-sub { white-space: normal; }
.search-more { margin: 8px 0 0; }
/* The page's own box is for phones (and no JavaScript); on desktop the top bar has one. */
@media (min-width: 901px) { .search-page-form { display: none; } }
@media (max-width: 900px) { .search input::-webkit-search-cancel-button { display: none; } }
kbd { padding: 0 5px; border: 1px solid var(--border); border-radius: 5px; font: 600 12px var(--font-num); background: var(--card); }
/* A row opened from a search result link (#gear-12) is outlined so it's easy to spot. */
details:target { outline: 2px solid var(--purple-600); outline-offset: 2px; scroll-margin-top: 72px; }
/* Change log */
.chg-row { display: grid; grid-template-columns: 116px 150px 112px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 14px; min-height: 56px; cursor: pointer; list-style: none; }
.chg-row::-webkit-details-marker { display: none; }
.chg-row > * { min-width: 0; }
.chg[open] > .chg-row { border-bottom: 1px solid var(--border); }
.chg-when { font-size: 13px; white-space: nowrap; }
.chg-who { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chg-text { display: grid; gap: 1px; }
.chg-summary { font-size: 14px; overflow-wrap: anywhere; }
.chg-note { font-size: 12px; overflow-wrap: anywhere; }
.chg-result { justify-self: end; }
.chg-detail { padding: 12px 14px 14px; display: grid; gap: 12px; }
.chg-detail > * { min-width: 0; }
.chg-detail .table-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.data.chg-diff th, table.data.chg-diff td { padding: 8px 12px; }
table.data.chg-diff tbody th { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--muted); width: 1%; }
table.data.chg-diff tbody tr:last-child th { border-bottom: 0; }
table.data.chg-diff tr.same td { color: var(--muted); }
table.data.chg-diff tr.changed td:last-child { font-weight: 600; background: var(--purple-50); }
.chg-meta { margin: 0; }
.chg-pager { display: flex; justify-content: center; gap: 10px; margin: 16px 0 8px; }
@media (max-width: 760px) {
  .chg-row { grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-areas: "text text text result" "who when area area"; gap: 4px 8px; padding: 10px 12px; }
  .chg-text { grid-area: text; }
  .chg-result { grid-area: result; align-self: start; }
  .chg-who { grid-area: who; font-size: 12px; color: var(--muted); }
  .chg-when { grid-area: when; font-size: 12px; }
  .chg-when::before { content: "· "; }
  .chg-area { grid-area: area; justify-self: start; }
  .chg-area .chip { font-size: 11px; padding: 1px 7px; }
  .chg-row .chevron { display: none; }
  .chg-detail { padding: 10px 12px 12px; }
}

/* Google (Connections card, Sales ads section, Customers reviews) */
.setup-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.setup-list li { position: relative; padding-left: 26px; overflow-wrap: anywhere; }
.setup-list li::before { position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; }
.setup-list li.ok::before { content: "✓"; background: var(--good-bg); color: var(--good-text); }
.setup-list li.todo { color: var(--warn-text); }
.setup-list li.todo::before { content: "!"; background: var(--warn-bg); color: var(--warn-text); }
.link-form select { width: 100%; font: inherit; font-size: 16px; min-height: var(--touch); }
.gads-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.gads-head .section-title { margin: 0; }
.gads-refresh { margin-left: auto; }
.gads-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 4px 0 6px; }
.gads-kpis > div { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--purple-50); min-width: 0; }
.gads-kpis b { font-size: 19px; }
.gads-sub { font-size: 14px; margin: 14px 0 6px; }
.gads-sub .muted { font-weight: 500; margin-left: 4px; }
.gads table.data td:first-child { white-space: nowrap; }
.gads table.data.campaigns td:first-child { white-space: normal; min-width: 190px; }
table.data tr.in-period td:first-child { box-shadow: inset 3px 0 0 var(--purple-600); }
table.data tr.replaced td { color: var(--muted); }
table.data tr.replaced td.num { text-decoration: line-through; }
.api-chip { margin-left: 6px; font-size: 11px; padding: 1px 7px; vertical-align: 1px; }
/* Sales → Ads: platform vs QuickBooks reconcile */
table.data.reconcile td:first-child, table.data.reconcile td:nth-child(2) { white-space: nowrap; }
table.data.reconcile tr.flagged td:first-child { box-shadow: inset 3px 0 0 var(--warn-text); }
.recon-src { display: block; font-family: var(--font-ui); font-size: 11px; white-space: nowrap; }
.recon-more { margin-top: 10px; }
.recon-more > summary { cursor: pointer; display: inline-flex; align-items: center; min-height: var(--touch); font-weight: 600; color: var(--purple-700); }
.recon-more ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.spend-add { margin-top: 0; }
.spend-add > summary { font-size: 15px; }
@media (max-width: 520px) {
  table.data.reconcile { font-size: 13px; }
  table.data.reconcile th, table.data.reconcile td { padding-left: 6px; padding-right: 6px; }
  table.data.reconcile th { white-space: normal; }
  table.data.reconcile td:nth-child(2) { white-space: normal; min-width: 90px; }
}
a.kpi-link { color: inherit; text-decoration: none; }
@media (hover: hover) { a.kpi-link:hover { border-color: var(--purple-600); } }
.stars { color: #B45309; letter-spacing: 1px; white-space: nowrap; }
.stars.big { font-size: 20px; }
.stars-cell { color: #B45309; white-space: nowrap; }
.review-text { margin: 4px 0 0; font-size: 14px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.review-reply { margin: 6px 0 0; padding: 6px 10px; border-left: 3px solid var(--purple-100); font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.google-review { background: #FFFBF2; border-color: #F3E3C3; }
.greviews-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; }
.greviews-score { display: grid; justify-items: center; gap: 2px; min-width: 110px; }
.greviews-avg { font-size: 36px; font-weight: 700; line-height: 1; }
.greviews-meta { display: grid; gap: 4px; flex: 1 1 280px; min-width: 0; }
.review-feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; margin-bottom: 12px; }
.review-card { padding: 12px 14px; display: grid; align-content: start; gap: 2px; min-width: 0; }
.review-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.review-match { margin-left: auto; max-width: 100%; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.review-more { margin-bottom: 12px; }
table.data.unmatched td { white-space: nowrap; }
.review-more > summary { list-style: none; display: inline-flex; margin-bottom: 10px; cursor: pointer; }
.review-more > summary::-webkit-details-marker { display: none; }
@media (max-width: 520px) { .review-feed { grid-template-columns: minmax(0, 1fr); } .gads-refresh { margin-left: 0; } }
/* ---- Facebook & Instagram ads (Sales > Ads & lead sources, Pages/Sales/_MetaAds.cshtml) ---- */
.meta-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 8px; }
.meta-head .section-title { margin: 0; }
.meta-ads .sub-title { font-size: 14px; margin: 16px 0 6px; }
.meta-ads .sub-title .muted { font-weight: 500; margin-left: 4px; }
.meta-ads .notice-inline { margin-bottom: 8px; }
.meta-kpis .kpi { box-shadow: none; background: var(--bg); }
.meta-note { margin: 8px 0 0; }
.meta-account-form { min-width: 0; }
.meta-account-form .field { flex: 1 1 240px; min-width: 0; }
.meta-account-form select { width: 100%; min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.meta-ads table.data td:first-child { min-width: 11em; }
.meta-ads table.data td.month { white-space: nowrap; min-width: 0; }
@media (max-width: 640px) {
  .meta-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .meta-kpis .kpi { padding: 10px 12px; }
}
.notice-inline.good { color: var(--good-text); margin: 8px 0 0; font-weight: 600; }

/* Settings page */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.settings-tile { display: flex; gap: 14px; align-items: flex-start; padding: 16px; text-decoration: none; color: inherit; }
.settings-tile .tile-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--purple-50); color: var(--purple-700); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.settings-tile .tile-icon svg { width: 22px; height: 22px; }
.settings-tile b { display: block; margin-bottom: 2px; }
@media (hover: hover) { a.settings-tile:hover { border-color: var(--purple-600); } }
.settings-tile.danger .tile-icon { background: #FBEAEA; color: #B91C1C; }

/* ---------- Settings → Users & access ---------- */
.access-roles { padding: 12px 16px; margin-bottom: 12px; }
.access-roles > summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.access-roles dl { display: grid; gap: 8px; margin: 10px 0; }
.access-roles dt { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.access-roles dd { margin: 2px 0 0 26px; font-size: 13px; }
.avatar.small { width: 18px; height: 18px; }
.access-figs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.access-form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; min-width: 0; }
.access-role { max-width: 260px; }
.access-table th[scope="row"] { font-weight: 600; white-space: nowrap; }
.access-check { min-height: 36px; white-space: nowrap; }
.access-check input { width: 18px; height: 18px; accent-color: var(--purple-600); }
.access-check.changed span { font-weight: 800; color: var(--purple-700); }
@media (max-width: 640px) {
  .access-list .emp-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .access-list .access-figs { grid-column: 2 / 3; justify-content: flex-start; }
  /* Phones: each area on its own block, its boxes wrapping underneath (no sideways scroll). */
  .access-table thead { display: none; }
  .access-table, .access-table tbody, .access-table tr { display: block; width: 100%; }
  .access-table tr { display: flex; flex-wrap: wrap; gap: 0 16px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
  table.data.access-table th[scope="row"], table.data.access-table td { display: block; border: 0; padding: 0; }
  .access-table th[scope="row"] { flex-basis: 100%; }
  .access-table td:empty { display: none; }
}

/* Monthly bonuses (/financials/bonuses) and Settings → Bonus rules. */
.bonus-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.bonus-bar .filters { margin: 0; }
.bonus-bar .button.icon.disabled { opacity: .4; pointer-events: none; }
.fin-section-plain { margin: 18px 0; min-width: 0; }
.fin-section-plain > .section-title { margin: 0 0 4px; }
.fin-section-plain > p.small { margin: 0 0 10px; }
.bonus-rules > summary { cursor: pointer; list-style: none; margin: 0; }
.bonus-rules > summary::-webkit-details-marker { display: none; }
.bonus-rule-list { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
table.data.compact th, table.data.compact td { padding: 8px 10px; }
table.data tr.row-current td { background: var(--purple-50); }
table.data.bonus-months td:first-child, table.data.bonus-months th { white-space: nowrap; }
table.data td.actions { white-space: nowrap; }
table.data td.actions form { display: inline-block; margin: 2px 6px 2px 0; }

/* Tables that stack into cards on phones (table.data.stack-phone; cells carry data-label). */
@media (max-width: 640px) {
  table.data.stack-phone thead { display: none; }
  table.data.stack-phone, table.data.stack-phone tbody, table.data.stack-phone tfoot, table.data.stack-phone tr, table.data.stack-phone td { display: block; width: 100%; box-sizing: border-box; }
  table.data.stack-phone tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  table.data.stack-phone td { border: 0; padding: 3px 0; text-align: left; }
  table.data.stack-phone td.num { text-align: left; }
  table.data.stack-phone td:first-child { font-weight: 600; }
  table.data.stack-phone td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: 12px; font-family: var(--font-ui); font-weight: 400; margin-right: 4px; }
  table.data.stack-phone td.actions { white-space: normal; padding-top: 8px; }
  table.data.stack-phone td.actions:empty { display: none; }
}
details.unlock > summary, details.ledger-ytd > summary, details.clawback > summary { cursor: pointer; list-style: none; }
details.unlock > summary::-webkit-details-marker, details.ledger-ytd > summary::-webkit-details-marker, details.clawback > summary::-webkit-details-marker { display: none; }
details.clawback { border-top: 1px solid var(--border); padding: 8px 0; font-size: 14px; }
details.ledger-ytd { margin-top: 4px; }
.small-chip.good { background: var(--good-bg); color: var(--good-text); }
.bonus-detail .detail-grid { margin: 0; }
.settings-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.settings-form .section-title { margin-top: 14px; }
.settings-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 12px 16px; margin-bottom: 8px; }
.settings-fields .field { display: grid; gap: 4px; min-width: 0; }
.settings-fields .field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.settings-fields input, .settings-fields select { width: 100%; min-height: 44px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); font-family: inherit; }

/* Sales → Ads & lead sources: channel pills (All · Facebook · Google · Other) next to the period, and the By channel table. */
.ads-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ads-bar .channel-pills { flex: 1 1 auto; min-width: 0; }
.pills.wrap { flex-wrap: wrap; overflow-x: visible; padding-bottom: 0; }
table.data.by-channel td:first-child { white-space: nowrap; }
table.data.by-channel tr.sub-row td { font-size: 13px; color: var(--muted); }
table.data.by-channel tr.sub-row td:first-child { padding-left: 24px; }
table.data.by-channel td.small { white-space: nowrap; }
@media (max-width: 520px) {
  .ads-total { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ads-total .kpi { padding: 10px 12px; min-width: 0; }
  .ads-total .kpi-value { font-size: 20px; }
}

/* Sales → Ads: lead and jobs-sold figures link to the JobTread records behind them (?list=leads|sold). */
a.drill { color: var(--purple-700); text-decoration: underline dotted; text-underline-offset: 3px; text-decoration-thickness: 1px; }
@media (hover: hover) { a.drill:hover { text-decoration-style: solid; } }
a.drill-kpi .kpi-value { color: var(--purple-700); }
.drill-back { display: inline-flex; align-items: center; min-height: var(--touch); font-size: 14px; font-weight: 600; text-decoration: none; }
@media (hover: hover) { .drill-back:hover { text-decoration: underline; } }
.drill .section-title .num { color: var(--muted); font-weight: 600; }
table.data.drill-table td:first-child a { font-weight: 600; }
table.data.drill-table .drill-job { margin-left: 6px; white-space: nowrap; font-family: var(--font-num); font-size: 13px; }
table.data.drill-table td.num { white-space: nowrap; }
@media (max-width: 640px) {
  table.data.drill-table td:empty { display: none; }
  table.data.drill-table td.num { white-space: normal; }
}

/* Website > Portfolio: publish bar, live/off switch, drag to reorder */
.wp-publish { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.wp-publish form { margin: 0; }
.wp-switch-form { margin: 0; }
.wp-switch { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 3px 12px 3px 3px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.wp-switch .wp-knob { width: 24px; height: 24px; border-radius: 50%; background: var(--border); }
.wp-switch.on { background: var(--good-bg); border-color: transparent; color: var(--good-text); flex-direction: row-reverse; padding: 3px 3px 3px 12px; }
.wp-switch.on .wp-knob { background: var(--good-text); }
.wp-move { white-space: nowrap; width: 1%; }
.wp-move .link-button { min-height: 28px; padding: 0 4px; font-size: 12px; text-decoration: none; }
.wp-grip { color: var(--muted); cursor: grab; padding-right: 4px; user-select: none; }
tr.wp-live { cursor: grab; }
tr.wp-dragging { opacity: 0.4; background: var(--purple-50); }
table.wp-saving { opacity: 0.6; pointer-events: none; }

/* Website > Blog */
.score { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 8px; font-size: 13px; font-weight: 700; background: #E5E7EB; color: #374151; }
.score.s5 { background: #1E8E3E; color: #fff; }
.score.s4 { background: #A8DDB5; color: #14532D; }
.score.s3 { background: #F9D56E; color: #6B4E00; }
.score.s2 { background: #F4A259; color: #5C2A00; }
.score.s1 { background: #D64545; color: #fff; }
.blog-scores { align-items: center; margin-bottom: 12px; }
.blog-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.blog-suggest input[type=date], .blog-suggest input.gap, .blog-date input[type=datetime-local], #proposal input[type=datetime-local] { min-height: var(--touch); padding: 0 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--text); font-family: inherit; }
.blog-suggest input.gap { width: 64px; }
.blog-date { display: flex; gap: 8px; align-items: center; }
.blog-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.blog-table td:nth-child(3) { min-width: 260px; }
.blog-title { font-weight: 600; }
.blog-desc { display: block; }
.blog-start { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 12px; }
.blog-start p { margin: 0; }
/* Website > Blog > one post (BlogRead): full width, website-like reading size. */
.blog-read-head { gap: 12px; flex-wrap: wrap; }
.blog-read { max-width: 760px; padding: 20px 24px; line-height: 1.7; font-size: 16px; }
.blog-read h1 { font-size: 28px; line-height: 1.25; margin: 8px 0 8px; }
.blog-read-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.blog-read-desc { font-size: 18px; color: var(--muted); margin: 0 0 4px; }
.blog-cover { display: block; width: 100%; height: auto; margin: 12px 0 1em; border-radius: 10px; }
.blog-article h1, .blog-article h2, .blog-article h3, .blog-article h4 { line-height: 1.3; margin: 1.4em 0 .4em; }
.blog-article p, .blog-article ul, .blog-article ol { margin: 0 0 1em; }
.blog-article img { max-width: 100%; height: auto; border-radius: 8px; }
.blog-read-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 760px; margin-top: 12px; }
.blog-read-nav a { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; text-decoration: none; color: var(--text); }
.blog-read-nav a.next { grid-column: 2; text-align: right; }
@media (max-width: 640px) {
  .blog-read { padding: 16px; }
  .blog-read h1 { font-size: 24px; }
  .blog-read-nav { grid-template-columns: 1fr; }
  .blog-read-nav a.next { grid-column: 1; }
  /* The post list stacks on a phone: score and title, then status, date and buttons, instead of a table wider than the screen. */
  .blog-table thead { display: none; }
  .blog-table, .blog-table tbody, .blog-table tr, .blog-table td { display: block; }
  .blog-table tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .blog-table td { padding: 4px 0; border: 0; }
  .blog-table td:nth-child(1), .blog-table td:nth-child(2) { display: inline-block; vertical-align: middle; margin-right: 6px; }
  .blog-table td:nth-child(1):empty { display: none; }
  .blog-table td:nth-child(3) { min-width: 0; width: auto; }
  .blog-table td:last-child form { display: inline; }
}
.blog-table td:nth-child(3) { width: 55%; }

.blog-date.draft input[type=datetime-local] { opacity: .55; }
.blog-edit { display: grid; gap: 14px; padding: 16px; max-width: 900px; }
.blog-edit .field input { width: 100%; }
.blog-edit textarea { width: 100%; min-height: 60vh; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font: 14px/1.55 ui-monospace, Consolas, monospace; resize: vertical; }
.wp-search { align-items: center; margin-bottom: 12px; }
.wp-search input[type=search] { flex: 1 1 260px; max-width: 420px; }
/* Portfolio interaction ratings (GA4): chip per row, period pills, Suggest order proposal, project page facts. */
.chip.wp-none { background: transparent; border: 1px dashed var(--border); color: var(--muted); font-weight: 500; }
a.wp-rating { text-decoration: none; }
.wp-period { display: inline-flex; gap: 4px; }
.wp-interaction-note { margin: 0 0 12px; }
.wp-suggest ol { margin: 8px 0 12px; padding-left: 24px; }
.wp-suggest li { margin: 4px 0; }
.wp-suggest li .chip { margin: 0 6px; }
.wp-suggest form { display: inline; margin: 0; }
.wp-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 12px 0 0; }
.wp-facts dt { color: var(--muted); }
.wp-facts dd { margin: 0; overflow-wrap: anywhere; }
.wp-search .link-button { min-height: var(--touch); min-width: 36px; text-decoration: none; }
tr.wp-filtered { display: none; }
.wp-ref { font-size: 12px; margin-top: 2px; }
.wp-link { font-size: 12px; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.wp-picker { margin-top: 8px; display: grid; gap: 6px; max-width: 520px; }
.wp-picker ul { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto; }
.wp-picker li { padding: 2px 0; }
.wp-picker .link-button { min-height: var(--touch); text-align: left; }
.wp-search select { flex: 0 0 auto; }

/* Website > Team */
.crew-face { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; display: block; }
.crew-name, .crew-role, .crew-order { min-height: 36px; padding: 4px 8px; font: inherit; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: inherit; }
.crew-name { width: 100%; min-width: 130px; }
.crew-order { width: 70px; }
.crew-live { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.crew-pick.link { display: block; margin-top: 4px; padding: 0; border: 0; background: none; color: var(--purple-700); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.crew-num { font-size: 12px; }
.crew-add { margin-top: 16px; }
.crew-add h3 { margin: 0 0 4px; }
.crew-add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.crew-add-row .crew-name { flex: 1 1 160px; }
.crop-dialog { border: 1px solid var(--border); border-radius: 14px; padding: 18px; max-width: min(380px, calc(100vw - 24px)); background: var(--card); color: inherit; }
.crop-dialog::backdrop { background: rgba(0,0,0,.45); }
.crop-dialog h3 { margin: 0 0 4px; }
#crop-canvas { width: 100%; max-width: 320px; aspect-ratio: 1; display: block; margin: 8px auto; border-radius: 8px; touch-action: none; cursor: grab; background: #222; }
.crop-zoom { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.crop-zoom input { flex: 1; }
.crop-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.crew-hired { font-size: 12px; margin-top: 2px; }
.crew-flag { font-size: 12px; margin-top: 2px; color: #B45309; max-width: 150px; }

/* Website > Reviews */
.rv-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.rv-filter { min-height: 36px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: inherit; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.rv-filter.active { background: var(--purple-600); border-color: var(--purple-600); color: #fff; }
.rv-list { list-style: none; margin: 0; padding: 0; }
.rv-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.rv-row:last-child { border-bottom: 0; }
.rv-row[hidden] { display: none; }
.rv-main p { margin: 0 0 6px; }
.rv-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.rv-stars { color: #e0a400; letter-spacing: 1px; }
.rv-badge { font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.rv-text.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rv-reply { font-size: 13px; color: var(--muted); border-left: 3px solid var(--border); padding-left: 10px; }
.link-button { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; font: inherit; font-size: 13px; cursor: pointer; }
.rv-controls { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 150px; }
.rv-switch, .rv-pin { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; min-height: 32px; }
.rv-rate { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.rv-rate select { min-height: 36px; padding: 4px 8px; font: inherit; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: inherit; }
@media (max-width: 640px) { .rv-row { grid-template-columns: minmax(0, 1fr); } .rv-controls { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; } }
.rv-likely { font-size: 12px; }

/* Hiring text chat and Inbox */
.hire-chat { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.hire-msg { display: grid; gap: 2px; max-width: 85%; padding: 8px 12px; border-radius: 14px; background: var(--purple-100); justify-self: start; }
.hire-msg.out { justify-self: end; background: var(--purple-600); color: #fff; }
.hire-msg.out .muted { color: inherit; opacity: .8; }
.hire-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.hire-msg .chan { font-size: 12px; opacity: .75; }
.hire-chat-form textarea { width: 100%; min-height: 84px; }
.hire-templates { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.hire-inbox-thread { padding: 10px 0; border-top: 1px solid var(--border); }

/* Hiring Messages screen (Pages/Hiring/Messages.cshtml), laid out like Google Voice on the web: the page never scrolls; the list
   scrolls on the left, and on the right only the thread scrolls between a one-line header and a composer pinned at the bottom. */
html:has(.msgs-app), body:has(.msgs-app) { height: 100%; overflow: hidden; }
body:has(.msgs-app) .shell { height: 100dvh; min-height: 0; }
body:has(.msgs-app) .main { display: flex; flex-direction: column; height: 100dvh; min-width: 0; }
body:has(.msgs-app) .page { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; padding-top: 12px; padding-bottom: 12px; }
body:has(.msgs-app) .page > :not(.msgs-app) { flex: none; }
.msgs { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.msgs-side, .msgs-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.msgs-side { border-right: 1px solid var(--border); }
.msgs-side > *, .msgs-pane > * { flex: none; }

/* Left: New message, search, the list (the only part that scrolls) */
.msgs-side-top { display: grid; gap: 8px; padding: 12px 12px 8px; }
.msgs-new > summary { list-style: none; }
.msgs-new > summary::-webkit-details-marker { display: none; }
.msgs-new-button { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 20px 0 14px; border-radius: 16px; background: var(--purple-50);
  color: var(--purple-700); font-weight: 600; cursor: pointer; box-shadow: 0 1px 2px rgba(60, 40, 90, .15); }
@media (hover: hover) { .msgs-new-button:hover { box-shadow: 0 2px 6px rgba(60, 40, 90, .2); } }
.msgs-new[open] form { margin-top: 8px; }
.msgs-search input { width: 100%; min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--bg); font: inherit; font-size: 16px; }
.msgs-list { flex: 1 1 0; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 0 0 8px; }
.msgs-item { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: center; min-height: 64px; padding: 8px 12px 8px 14px;
  color: inherit; text-decoration: none; border-radius: 0 999px 999px 0; margin-right: 8px; }
.msgs-item.active { background: var(--purple-50); }
@media (hover: hover) { .msgs-item:not(.active):hover { background: var(--bg); } }
.msgs-main { display: grid; gap: 2px; min-width: 0; }
.msgs-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.msgs-name, .msgs-preview { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msgs-name { font-weight: 500; }
.msgs-preview { flex: 1; color: var(--muted); font-size: 13px; }
.msgs-time { margin-left: auto; flex: none; color: var(--muted); font-size: 12px; white-space: nowrap; }
.msgs-item.unread .msgs-name, .msgs-item.unread .msgs-preview, .msgs-item.unread .msgs-time { font-weight: 700; color: var(--text); }
.msgs-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.msgs-item.unread .msgs-dot { background: var(--purple-600); }
.msgs-chan { flex: none; font-size: 10px; font-weight: 700; line-height: 14px; padding: 0 5px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.msgs-chan.chan-indeed { border-color: #2557a7; color: #2557a7; }
.msgs-chan.chan-craigslist { border-color: #6b2fa0; color: #6b2fa0; }
.msgs-chan.chan-website { border-color: #8a6d00; color: #6b5500; }
.msgs-empty { padding: 16px; }

/* Round avatars with initials, a steady colour per conversation */
.msgs-avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; color: #fff;
  font-size: 15px; font-weight: 600; letter-spacing: .02em; user-select: none; }
.hue-0 { background: #7B4BB0; } .hue-1 { background: #1F7A8C; } .hue-2 { background: #C2410C; } .hue-3 { background: #2E7D32; }
.hue-4 { background: #AD1457; } .hue-5 { background: #3F51B5; } .hue-6 { background: #8D6E00; } .hue-7 { background: #5D6B7A; }

/* Right: one-line header with call and ⋮ */
.msgs-head { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--border); }
.msgs-head .msgs-avatar { width: 36px; height: 36px; font-size: 14px; }
.msgs-title { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.msgs-name-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.msgs-head-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 600; }
.msgs-head-name a { color: inherit; text-decoration: none; }
@media (hover: hover) { .msgs-head-name a:hover { text-decoration: underline; } }
.msgs-head-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.msgs-from-text { flex: none; font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; white-space: nowrap; }
.msgs-back { display: none; }
.msgs-icon-button { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer; list-style: none; text-decoration: none; }
.msgs-icon-button::-webkit-details-marker { display: none; }
@media (hover: hover) { .msgs-icon-button:hover { background: var(--bg); color: var(--text); } }

/* Popovers: rename, the ⋮ menu, composer tools */
.msgs-pop { position: relative; flex: none; }
.msgs-pop > summary { list-style: none; cursor: pointer; }
.msgs-pop > summary::-webkit-details-marker { display: none; }
.msgs-pop-panel, .msgs-tools-panel { position: absolute; z-index: 20; background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(40, 20, 70, .18); padding: 8px; }
.msgs-rename > summary { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; color: var(--muted); }
@media (hover: hover) { .msgs-rename > summary:hover { background: var(--bg); color: var(--text); } }
.msgs-rename .msgs-pop-panel { top: 32px; left: 0; width: min(340px, 80vw); }
.msgs-menu-panel { top: 44px; right: 0; width: min(340px, calc(100vw - 32px)); max-height: 70dvh; overflow-y: auto; display: grid; gap: 4px; }
.msgs-menu-item { display: flex; align-items: center; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: none;
  color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; list-style: none; }
.msgs-menu-item::-webkit-details-marker { display: none; }
@media (hover: hover) { .msgs-menu-item:hover { background: var(--bg); } }
.msgs-menu-form { display: grid; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); }
.msgs-menu-form .button { justify-self: start; }
.msgs-menu-sub .stack-form { padding: 0 10px 8px; margin-top: 4px; }
.msgs-menu-note { padding: 8px 10px; border-top: 1px solid var(--border); font-size: 13px; }
.msgs-menu-note p { margin: 0 0 6px; }
.msgs-web-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 6px 8px; }
.msgs-web-chips .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Slim, dismissible status lines under the header */
.msgs-banners:empty { display: none; }
.msgs-banner { display: flex; align-items: center; gap: 8px; margin: 0; padding: 4px 6px 4px 16px; min-height: 32px; font-size: 13px;
  background: var(--purple-50); color: var(--text); border-bottom: 1px solid var(--border); }
.msgs-banner > span { flex: 1; min-width: 0; }
.msgs-banner.good { background: var(--good-bg); color: var(--good-text); }
.msgs-banner.warn { background: var(--warn-bg); color: var(--warn-text); }
.msgs-banner[hidden] { display: none; }
.msgs-banner-action { flex: none; border: 0; background: none; color: var(--purple-700); font: inherit; font-weight: 600; cursor: pointer; padding: 4px 6px; }
.msgs-banner-x { flex: none; margin-left: auto; width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; opacity: .7; }
@media (hover: hover) { .msgs-banner-x:hover { opacity: 1; background: rgba(0, 0, 0, .06); } }

/* Thread: the only part that scrolls; their bubbles light on the left, ours purple on the right */
.msgs-thread { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; margin: 0; padding: 16px 16px 8px;
  display: flex; flex-direction: column; gap: 10px; }
.msgs-thread > :first-child { margin-top: auto; }
.msgs-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: min(75%, 560px); }
.msgs-msg.out { align-self: flex-end; align-items: flex-end; }
.msgs-bubble { padding: 8px 14px; border-radius: 18px; background: #EFEDF2; color: var(--text); font-size: 15px; line-height: 1.4; }
.msgs-msg.in .msgs-bubble { border-bottom-left-radius: 6px; }
.msgs-msg.out .msgs-bubble { background: var(--purple-600); color: #fff; border-bottom-right-radius: 6px; }
.msgs-msg.out .msgs-bubble a { color: inherit; }
.msgs-msg.out .hire-msg-original summary { color: inherit; }
.msgs-msg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin-top: 3px; padding: 0 6px; color: var(--muted); font-size: 11px; }
.msgs-msg.out .msgs-msg-meta { justify-content: flex-end; }
.hire-msg-original summary { font-size: 12px; cursor: pointer; opacity: .8; }
.hire-msg-translate .link-button { font-size: 11px; min-height: 0; padding: 0 2px; }
.msgs-none { text-align: center; padding: 24px 0; }
.msgs-msg .msgs-appphoto { flex-wrap: wrap; padding: 0 6px; font-size: 13px; }
.msgs-msg .msgs-appphoto .button { min-height: 32px; padding: 0 12px; font-size: 13px; }
.msgs-placeholder { margin: auto; text-align: center; }

/* Composer pinned at the bottom: tools, one auto-growing line, send arrow */
.msgs-foot { padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--card); }
.msgs-foot:empty { display: none; }
.msgs-foot-note { margin: 0; padding: 6px 4px; color: var(--muted); font-size: 13px; }
.msgs-composer { position: relative; display: flex; align-items: flex-end; gap: 6px; flex-wrap: wrap; }
.msgs-composer textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 40dvh; padding: 11px 16px; border: 0; border-radius: 22px; background: var(--bg);
  font: inherit; font-size: 16px; line-height: 22px; resize: none; overflow-y: auto; }
.msgs-composer textarea:focus-visible { outline: 2px solid var(--purple-600); outline-offset: 0; }
.msgs-tools { flex: none; }
.msgs-tools > summary { list-style: none; }
.msgs-tools-panel { bottom: 52px; left: 0; width: min(520px, calc(100vw - 32px)); max-height: 50dvh; overflow-y: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.msgs-tools-panel .hire-check { flex-basis: 100%; }
.msgs-send { flex: none; position: relative; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--purple-600); color: #fff; cursor: pointer;
  font-size: 0; /* the label is for screen readers and the "Sending…" swap; the arrow is drawn below */ }
.msgs-send::before { content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 20.5 21 12 3 3.5V10l12 2-12 2z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 20.5 21 12 3 3.5V10l12 2-12 2z'/%3E%3C/svg%3E") center / contain no-repeat; }
.msgs-send:disabled { opacity: .5; cursor: default; }
.msgs-compose-note { flex-basis: 100%; margin: 0; padding: 0 16px; color: var(--muted); font-size: 12px; }
.msgs-compose-note:empty { display: none; }
.msgs-foot .hire-voice { margin: 0; max-height: 40dvh; overflow-y: auto; }

/* Phone: the list, then the thread with a back arrow; the composer stays pinned */
@media (max-width: 767px) {
  body:has(.msgs-app) .page { padding: 0; }
  body:has(.msgs-app.has-open) .module-head { display: none; }
  .msgs { grid-template-columns: minmax(0, 1fr); border: 0; border-radius: 0; }
  .msgs.has-open .msgs-side { display: none; }
  .msgs:not(.has-open) .msgs-pane { display: none; }
  .msgs-side { border-right: 0; }
  .msgs-item { margin-right: 0; border-radius: 0; padding-left: 16px; }
  .msgs-head { padding: 6px 4px 6px 0; gap: 8px; min-height: 56px; }
  .msgs-back { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: var(--text); }
  .msgs-msg { max-width: 85%; }
  .msgs-thread { padding: 12px 10px 6px; }
  .msgs-foot { padding-left: 8px; padding-right: 8px; }
}

.hire-voice { overflow-wrap: anywhere; }
.hire-voice-body { width: 100%; min-height: 110px; margin: 8px 0; }
/* Website chat on the Messages screen (Pages/Hiring/_WebsiteChat.cshtml) and Notifications (/notifications). */
.notice.good { background: var(--good-bg); color: var(--good-text); border-color: #BFDCC8; }
.stack-form { display: grid; gap: 10px; max-width: 520px; margin-top: 10px; }
.stack-form fieldset.field { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.stack-form fieldset.field legend { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.notify-card .form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.msgs-notify-link { justify-self: start; }
.notify-page { display: grid; gap: 12px; }
.notify-page > .card { padding: 16px 18px; }
.notify-page h2 { margin: 0 0 8px; font-size: 17px; }

/* Messages: filters (All / Needs a look / Follow up), tags, do-not-hire line, quick position */
.msgs-filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.msgs-filters::-webkit-scrollbar { display: none; }
.msgs-filter { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: inherit; font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; }
.msgs-filter.active { background: var(--purple-50); border-color: var(--purple-600); color: var(--purple-700); font-weight: 600; }
@media (pointer: coarse) { .msgs-filter { min-height: 40px; } }
.msgs-tag { flex: none; font-size: 10px; font-weight: 600; line-height: 14px; color: var(--warn-text); background: var(--warn-bg); border-radius: 999px; padding: 0 6px; }
.msgs-banner.bad { background: #FDECEC; color: #8A1C1C; }
/* The same do-not-hire and needs-a-look cards on the applicant page (Candidate.cshtml) */
.msgs-dnh { background: #FDECEC; color: #8A1C1C; border: 1px solid #F3B7B7; border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.msgs-look { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.msgs-dnh-form:not(.msgs-pop)[open] { flex-basis: 100%; }
.msgs-position { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; padding-top: 4px; padding-bottom: 4px; }
.msgs-position .msgs-filter { min-height: 26px; padding: 0 10px; font-size: 12px; background: var(--card); }
.card.msgs-position { padding: 10px 14px; }
.msgs-banner > .msgs-banner-label { flex: none; }
.msgs-dnh-form .msgs-pop-panel { top: 30px; right: 0; width: min(360px, 80vw); }
.msgs-mail { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.msgs-mail p { margin: 0 0 4px; }
.msgs-mail ul { margin: 4px 0 0; padding-left: 18px; }
.chip-guess { background: transparent; border: 1px dashed var(--border); color: var(--muted, #666); }

/* Hiring applicant list: calm by default (search, one row of stage pills, the rows); the rest behind Filters. */
.chip.neutral { background: #EEEDF2; color: #47434F; }
.chip.blue { background: #E1ECFA; color: #1B4C86; }
.chip.amber { background: #FBEBC8; color: #6E4300; }
.chip.orange { background: var(--warn-bg); color: var(--warn-text); }
.hire-search input { width: 100%; min-height: var(--touch); padding: 0 16px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); font: inherit; font-size: 16px; }
.hire-stage-row { position: relative; }
.hire-stages { flex-wrap: nowrap; margin-bottom: 8px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); padding-right: 28px; }
.pill-quiet { background: transparent; border-style: dashed; font-weight: 500; }
.hire-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 12px; }
.hire-toolbar > details > summary { list-style: none; }
.hire-toolbar > details > summary::-webkit-details-marker { display: none; }
.hire-toolbar .pill-count { margin-left: 6px; background: var(--purple-600); color: #fff; opacity: 1; border-radius: 999px; padding: 0 7px; }
.hire-count { margin-left: auto; }
.hire-filters[open], .hire-add-quick[open] { flex-basis: 100%; order: 3; }
.hire-filters-sheet { display: grid; gap: 14px; margin-top: 10px; padding: 14px; background: var(--card); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(28,23,38,.08); }
.hire-filter-group { display: grid; gap: 6px; }
.hire-filter-label { font-size: 13px; color: var(--muted); }
.hire-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pos-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; border: 1px solid rgba(0,0,0,.08); }
.hire-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.hire-add-quick form { margin-top: 10px; padding: 14px; background: var(--card); border-radius: var(--radius); }
.hire-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hire-row2 { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; background: var(--card); border-radius: var(--radius); color: inherit; text-decoration: none; }
@media (hover: hover) { .hire-row2:hover { box-shadow: 0 2px 10px rgba(28,23,38,.07); } }
.hire-avatar2 { width: 40px; height: 40px; font-size: 14px; font-weight: 600; }
.hire-avatar2.guessed { box-shadow: inset 0 0 0 2px var(--card), 0 0 0 1px var(--border); }
.hire-row2-main { display: grid; min-width: 0; }
.hire-row2-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hire-row2-sub { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hire-more { text-align: center; margin: 14px 0; }
.pos-dot.pos-painter { background: var(--dot-painter); }
.avatar.pos-painter { background: var(--pos-painter-bg); color: var(--pos-painter); }
.pos-dot.pos-helper { background: var(--dot-helper); }
.avatar.pos-helper { background: var(--pos-helper-bg); color: var(--pos-helper); }
.pos-dot.pos-foreman { background: var(--dot-foreman); }
.avatar.pos-foreman { background: var(--pos-foreman-bg); color: var(--pos-foreman); }
.pos-dot.pos-stainer { background: var(--dot-stainer); }
.avatar.pos-stainer { background: var(--pos-stainer-bg); color: var(--pos-stainer); }
.pos-dot.pos-office { background: var(--dot-office); }
.avatar.pos-office { background: var(--pos-office-bg); color: var(--pos-office); }
.pos-dot.pos-sales { background: var(--dot-sales); }
.avatar.pos-sales { background: var(--pos-sales-bg); color: var(--pos-sales); }
.pos-dot.pos-unknown { background: var(--dot-unknown); }
.avatar.pos-unknown { background: var(--pos-unknown-bg); color: var(--pos-unknown); }
@media (max-width: 760px) {
  /* The Filters sheet rises from the bottom on a phone. */
  .hire-filters[open] .hire-filters-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-height: 80dvh; overflow-y: auto; margin: 0; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 40px rgba(28,23,38,.25); }
  .hire-row2 { padding: 12px; }
}

/* Interview flow: application gating, the texted application photo, Start interview */
.msgs-appphoto { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-weight: 600; }
.msgs-start { justify-self: start; margin: 4px 0; }
.hire-start { margin-left: auto; align-self: center; }
.hire-day-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.hire-reminder { background: var(--purple-50); border-radius: var(--radius-sm); padding: 10px 12px; }
.hire-override { margin-top: 10px; }
.sheet-who { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0 14px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.sheet-earlier { flex-basis: 100%; }
.sheet-nav { display: flex; align-items: center; gap: 10px; }
.sheet-nav[hidden] { display: none; }
.sheet-progress { flex: 1; text-align: center; font-size: 13px; color: var(--muted); }
.sheet.stepping .sheet-step { min-height: 50dvh; }
.sheet.stepping .choice label span { min-height: 52px; min-width: 52px; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; }
.sheet.stepping .sheet-nav { position: sticky; bottom: 0; background: var(--card); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); margin-top: 16px; }
.sheet.stepping .sheet-nav .button { min-height: 52px; min-width: 110px; }
@media (max-width: 760px) { body:has(.sheet.stepping) .module-head { display: none; } }

/* Select mode and "Text selected" */
.hire-row2-select { grid-template-columns: 28px minmax(0, 1fr) auto; cursor: pointer; }
.hire-row2-select input { width: 22px; height: 22px; accent-color: var(--purple-600); }
.hire-row2-select.off { opacity: .55; cursor: not-allowed; }
.hire-row2-select:has(input:checked) { box-shadow: inset 0 0 0 2px var(--purple-600); }
.hire-select-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--card); border-radius: var(--radius) var(--radius) 0 0; box-shadow: 0 -6px 20px rgba(28,23,38,.08); }
.hire-draft { display: grid; gap: 10px; padding: 14px; }
.hire-draft.sent { opacity: .7; }
.hire-draft-who { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.hire-draft-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.hire-draft-form textarea { width: 100%; font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
@media (max-width: 760px) { .hire-draft-form { grid-template-columns: 1fr; } }

@media (max-width: 760px) { body:has(.sheet.stepping) .module-head { display: none; } }

/* Website > Landing pages */
.lp-period { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 12px; }
.lp-period select { min-height: 36px; padding: 4px 8px; font: inherit; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: inherit; }
.lp-audience { margin: 0 0 8px; font-size: 18px; }
.lp-winner td { background: var(--good-bg); }
.lp-version-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.lp-version-head h2 { margin: 0; font-size: 17px; }
.lp-url { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0 4px; }
.lp-url code { padding: 4px 8px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); font-size: 13px; overflow-wrap: anywhere; }
.lp-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 12px 0; }
.lp-fields label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.lp-fields input, .lp-fields textarea, .lp-tags textarea, .lp-builder input, .lp-builder select, .lp-addad select { min-height: 36px; padding: 6px 8px; font: inherit; font-weight: 400; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: inherit; width: 100%; }
.lp-tags { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; padding-top: 12px; border-top: 1px solid var(--border); }
.lp-tags h3 { margin: 0 0 6px; font-size: 14px; }
.lp-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; font-size: 14px; }
.lp-checks label { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.lp-tags textarea { margin-bottom: 6px; }
.lp-ads { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.lp-addad { display: flex; gap: 8px; align-items: center; }
.lp-builder { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.lp-builder summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.lp-builder-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px 12px; margin: 8px 0; }
.lp-builder-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.lp-qr img { display: block; image-rendering: pixelated; background: #fff; }
@media (max-width: 900px) { .lp-builder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .lp-fields, .lp-tags, .lp-builder-grid { grid-template-columns: minmax(0, 1fr); } }
/* Landing pages overview: one card per audience, its versions side by side with a scaled live preview. */
/* .card has no padding of its own: inset the audience boxes and the version page's boxes so nothing sits on the border. */
.lp-audience-card, .lp-detail .card { padding: 16px 18px; }
.lp-audience-card { margin-bottom: 16px; }
.lp-audience-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.lp-audience-head .lp-audience { margin: 0; }
.lp-audience-head code { padding: 1px 6px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }
.lp-verdict { margin: 6px 0 12px; }
/* Columns are counted from the 300px minimum (not a fixed maximum), so versions sit side by side and share the row evenly
   when there's room, and stack full width when there isn't; min(100%, ...) keeps a narrow screen from overflowing. */
.lp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.lp-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--card); }
.lp-card-winner { border-color: var(--good-text); box-shadow: 0 0 0 2px var(--good-bg); }
.lp-card-off .lp-card-body { opacity: .75; }
.lp-thumb { display: block; position: relative; aspect-ratio: 4 / 3; background: var(--bg); border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.lp-thumb .lp-frame { position: absolute; inset: 0; }
.lp-thumb .lp-frame iframe { pointer-events: none; }
.lp-thumb:hover, .lp-thumb:focus-visible { outline: 2px solid var(--purple-600); outline-offset: -2px; }
.lp-thumb-off { display: flex; align-items: center; justify-content: center; height: 100%; padding: 16px; text-align: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--border); border-radius: 8px; box-sizing: border-box; }
.lp-frame { display: block; position: relative; overflow: hidden; }
.lp-frame iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.lp-frame-fit iframe { position: absolute; top: 0; transform-origin: 0 0; }
.lp-card-body { display: flex; flex-direction: column; gap: 6px; padding: 12px; flex: 1; }
.lp-card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.lp-card-title a { color: inherit; text-decoration: none; font-size: 15px; }
.lp-card-title a:hover { text-decoration: underline; }
.lp-card-idea { margin: 0; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lp-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 4px 0; }
.lp-stats div { padding: 6px 8px; border-radius: 8px; background: var(--bg); }
.lp-stats dt { font-size: 11px; color: var(--muted); }
.lp-stats dd { margin: 0; font-weight: 700; font-size: 15px; }
.lp-stats-wide { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.lp-card-tags { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.lp-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.lp-numbers { margin-top: 12px; }
.lp-numbers summary { cursor: pointer; font-weight: 600; min-height: 32px; }
/* One version's page: edit fields on the left, a large live preview on the right. */
.lp-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; }
.lp-detail-head h1 { margin: 0; font-size: 22px; }
.lp-siblings { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.lp-siblings a { text-decoration: none; }
.lp-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.lp-detail-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.lp-detail-main > .card { margin: 0; }
.lp-detail-preview { position: sticky; top: 12px; }
.lp-preview-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; }
.lp-preview-modes { display: inline-flex; gap: 4px; }
.lp-frame-large { height: min(78vh, 900px); border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.lp-fields-one { grid-template-columns: minmax(0, 1fr); }
.lp-live { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; margin: 4px 0; }
.lp-builder-top { margin-top: 0; padding-top: 0; border-top: 0; }
.lp-inline-form { display: inline; }
.lp-detail .lp-builder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .lp-detail { grid-template-columns: minmax(0, 1fr); } .lp-detail-preview { position: static; } .lp-siblings { margin-left: 0; } }
/* Website > Services: the list's Add form and one page's edit form (Pages/Website/Service.cshtml). */
.sv-add, .sv-form section.card { display: grid; gap: 10px; }
.sv-add label, .sv-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.sv-add input[type=text], .sv-add textarea, .sv-form input[type=text], .sv-form input[type=number], .sv-form textarea, .sv-form select { width: 100%; font-weight: 400; }
.sv-form textarea { font: inherit; line-height: 1.5; resize: vertical; }
.sv-slug { display: flex; align-items: center; gap: 2px; font-weight: 400; }
.sv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sv-head h2 { margin: 0; }
.sv-form label.sv-live, .sv-form label.sv-check { flex-direction: row; align-items: center; gap: 8px; min-height: 32px; }
.sv-order { max-width: 200px; }
.sv-hero { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.sv-hero img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: var(--purple-50); }
.sv-row { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--border); }
.sv-row-tools { display: flex; gap: 6px; justify-content: flex-end; }
.sv-row-tools .link-button { min-height: 32px; padding: 0 6px; }
.sv-inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px 12px; align-items: end; }
.sv-card { grid-template-columns: 140px minmax(0, 1fr); }
.sv-card-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--purple-50); }
.sv-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 16px; }
.sv-form .sv-checks label { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; min-height: 32px; }
.sv-scroll { max-height: 320px; overflow-y: auto; }
.sv-save { position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; z-index: 2; }
@media (max-width: 640px) { .sv-hero, .sv-card { grid-template-columns: minmax(0, 1fr); } .sv-hero img { max-width: 320px; } }

/* Website > Partners (list reuses the portfolio's switch and drag styles) */
tr.pt-row { cursor: grab; }
.pt-edit { border: 0; margin: 0; padding: 0; min-width: 0; }
.pt-fields { display: grid; gap: 12px; }
.pt-fields h2, .pt-fields h3 { margin: 4px 0 0; }
.pt-fields label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.pt-fields label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; min-height: 32px; }
.pt-fields input:not([type=checkbox]), .pt-fields textarea, .pt-row-fields input, .pt-row-fields select, .pt-row-fields textarea, #pt-pick { min-height: 36px; padding: 6px 8px; font: inherit; font-weight: 400; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: inherit; width: 100%; }
.pt-members { margin: 8px 0 12px; padding-left: 24px; display: grid; gap: 4px; }
.pt-members li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.pt-members .pt-member-name { flex: 1 1 240px; }
.pt-row-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 10px 0; border-top: 1px solid var(--border); }
.pt-row-fields textarea { grid-column: 1 / -1; }
@media (max-width: 640px) { .pt-row-fields { grid-template-columns: minmax(0, 1fr); } }
/* ---------- Hiring > Ads (/hiring/ads) ---------- */
/* Hiring > Applicants: By ad / By applicant switch, then By ad's position → ad → when it ran → people. Each summary row is clickable end to end. */
.hire-views { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hire-views .hire-search { flex: 1 1 220px; }
.hire-ad-group { margin-bottom: 16px; }
.hire-ad-group > .section-title { margin: 0 0 8px; }
.hire-adg { padding: 0; margin-bottom: 10px; overflow: hidden; }
.hire-adg > summary, .hire-run > summary, .hire-step > summary { list-style: none; cursor: pointer; }
.hire-adg > summary::-webkit-details-marker, .hire-run > summary::-webkit-details-marker, .hire-step > summary::-webkit-details-marker { display: none; }
.hire-adg-top, .hire-run-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: var(--touch); }
.hire-adg-top { padding: 10px 14px; }
.hire-adg-top::after, .hire-run-top::after { content: ""; flex: none; width: 7px; height: 7px; margin: 0 2px 3px 0; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); }
.hire-adg[open] > .hire-adg-top::after, .hire-run[open] > .hire-run-top::after { transform: rotate(-135deg); margin: 3px 2px 0 0; }
.hire-adg[open] > .hire-adg-top { border-bottom: 1px solid var(--border); }
.hire-adg-chips { display: flex; gap: 4px; }
.hire-adg-title { flex: 1 1 180px; display: grid; min-width: 0; }
.hire-adg-title b { overflow-wrap: anywhere; }
.hire-adg-body { display: grid; gap: 10px; padding: 12px 14px 14px; }
.hire-ad-code { margin: 0; }
.hire-ad-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.hire-ad-actions .inline-form { align-items: flex-end; }
.hire-step[open] { flex-basis: 100%; }
.hire-step > summary { display: inline-flex; }
.hire-step form { margin-top: 8px; }
.hire-ad-edit > summary { cursor: pointer; min-height: var(--touch); display: flex; align-items: center; }
.hire-ad-form { display: grid; gap: 8px; }
.hire-ad-form textarea { width: 100%; font: inherit; font-size: 16px; }
.hire-ad-help { padding: 0 14px 10px; margin: 0; }
.hire-runs-head { font-size: 14px; margin: 6px 0 0; }
.hire-runs { display: grid; gap: 6px; }
.hire-run { border: 1px solid var(--border); border-radius: 10px; background: #FCFBFE; }
.hire-run-top { padding: 6px 12px; }
.hire-run-top .pill-count { margin-left: auto; }
.hire-run-body { display: grid; gap: 8px; padding: 0 12px 12px; }
.hire-run-body > p { margin: 0; }
.hire-noad { display: flex; align-items: center; justify-content: space-between; min-height: var(--touch); padding: 10px 14px; color: inherit; text-decoration: none; font-weight: 600; }

/* ---------- Prospect (door-to-door map) ---------- */
.prospect-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; font-size: 13px; }
.prospect-key { display: inline-flex; align-items: center; gap: 6px; }
.prospect-key i, .prospect-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }
.prospect-dot { width: 14px; height: 14px; }
/* Territories card: "212 houses · 41 knocked (19%)" with a thin bar. */
.prospect-houses { font-size: 13px; }
.prospect-houses-bar { display: block; height: 4px; margin-top: 3px; max-width: 220px; border-radius: 2px; background: var(--border, #e5e7eb); overflow: hidden; }
.prospect-houses-bar i { display: block; height: 100%; }
.prospect-row-lead { display: inline-flex; align-items: center; gap: 10px; }
.prospect-row-lead input { width: 18px; height: 18px; margin: 0; }
.prospect-map-wrap { position: relative; overflow: hidden; padding: 0; }
.prospect-map { height: calc(100dvh - 260px); min-height: 420px; }
.prospect-search { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; width: min(420px, calc(100% - 70px)); }
.prospect-search input { flex: 1; min-width: 0; min-height: var(--touch); padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; font: inherit; font-size: 16px; background: var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
/* Address suggestions under the box (prospect-search.js); over the side panel while open. */
.prospect-search.open { z-index: 5; }
.prospect-suggest { position: absolute; top: calc(100% + 4px); left: 0; right: 0; max-height: min(320px, 60dvh); overflow-y: auto; margin: 0; padding: 4px 0; list-style: none; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.prospect-suggest li { display: flex; flex-direction: column; justify-content: center; min-height: var(--touch); padding: 6px 12px; cursor: pointer; line-height: 1.25; }
.prospect-suggest li b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prospect-suggest li small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prospect-suggest li.on { background: var(--purple-50); }
@media (hover: hover) { .prospect-suggest li[role=option]:hover { background: var(--purple-50); } }
.prospect-suggest .prospect-suggest-none { cursor: default; color: var(--muted); }
.prospect-panel { position: absolute; top: 10px; right: 10px; bottom: 10px; width: min(380px, calc(100% - 20px)); overflow-y: auto; padding: 14px; box-shadow: 0 4px 18px rgba(0,0,0,.18); }
.prospect-panel p { margin: 4px 0; }
/* A territory's name on the office Map (prospect-map.js): a white tag, so it reads over the satellite view. */
.prospect-territory-name { padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.92); box-shadow: 0 1px 4px rgba(0,0,0,.3); white-space: nowrap; }
.prospect-jt { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 6px 0 10px; }
.prospect-jt-filter { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.prospect-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 16px; }
/* Two columns that shrink to the panel (a long status or the date box no longer pushes it sideways). */
.prospect-panel .inline-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.prospect-panel .inline-form .field { min-width: 0; }
.prospect-panel .inline-form .field.grow, .prospect-panel .inline-form textarea, .prospect-panel .prospect-change-address { grid-column: 1 / -1; }
.prospect-panel .inline-form input:not([type=checkbox]), .prospect-panel .inline-form select, .prospect-panel .inline-form textarea { width: 100% !important; min-width: 0; font-size: 16px; }
.prospect-panel .prospect-biz-switch > span:first-child { display: none; }
.prospect-biz-switch > span:last-child { justify-content: flex-start; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); }
.inline-form .field.prospect-biz-switch input[type=checkbox] { flex: none; width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0; }
.prospect-panel .prospect-change-address { justify-self: start; }
.prospect-address { display: contents; }
.prospect-address[hidden], .prospect-biz-name[hidden] { display: none; }
.prospect-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.prospect-chip { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 2px solid var(--c); background: var(--card); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.prospect-chip.on { background: var(--c); color: #fff; }
.prospect-notes { white-space: pre-wrap; background: var(--bg); border-radius: var(--radius-sm); padding: 8px 10px; }
.prospect-activity { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 8px; font-size: 13px; }
@media (max-width: 700px) {
  .prospect-map { height: calc(100dvh - 230px); }
  .prospect-panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 65%; border-radius: var(--radius) var(--radius) 0 0; }
}

/* ---------- Prospect Overview and Sessions ---------- */
/* Overview: door-knocking wins (the gold of the Sold pins, prospect-wins.js). */
.prospect-wins-kpi { border-left: 4px solid #F5B301; }
.prospect-mix { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
table.data.prospect-reps td, table.data.prospect-sessions td { white-space: nowrap; }
table.data.prospect-reps td:nth-child(3) { white-space: normal; min-width: 220px; }
.prospect-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.prospect-bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 13px; }
.prospect-bars li { display: grid; grid-template-columns: minmax(120px, 40%) 1fr 40px; align-items: center; gap: 10px; }
.prospect-bars .num { text-align: right; font-weight: 600; }
.prospect-bar { height: 10px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.prospect-bar b { display: block; height: 100%; border-radius: 999px; }
.prospect-two .prospect-activity { max-height: 520px; overflow-y: auto; }
.prospect-kpi-text { font-size: 18px; overflow-wrap: anywhere; }
.prospect-session { display: grid; grid-template-columns: 1fr minmax(260px, 340px); gap: 12px; align-items: start; }
.prospect-map.prospect-trail { height: calc(100dvh - 300px); min-height: 380px; }
.prospect-order { max-height: calc(100dvh - 300px); min-height: 380px; overflow-y: auto; margin: 0; }
.prospect-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; counter-reset: door; font-size: 14px; }
.prospect-steps li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; counter-increment: door; }
.prospect-steps li:hover, .prospect-steps li.on { background: var(--purple-50); }
.prospect-step-n { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; }
.prospect-step-n::before { content: counter(door); }
@media (max-width: 900px) {
  .prospect-session { grid-template-columns: 1fr; }
  .prospect-map.prospect-trail { height: 55dvh; min-height: 300px; }
  .prospect-order { max-height: none; min-height: 0; }
}

/* ---------- Prospect office set-up (Territories, Teams, Reps, Statuses; wwwroot/js/prospect-admin.js) ---------- */
.prospect-admin-split { display: grid; gap: 16px; }
.emp-row.prospect-row { grid-template-columns: minmax(0, 1fr) auto auto auto; }
@media (min-width: 1100px) { .prospect-admin-split { grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); align-items: start; } }
.prospect-territory-map { height: calc(100dvh - 300px); min-height: 380px; }
.prospect-territory-list { align-content: start; }
/* A bottom-left map control (prospect-admin.js), stacked by Google above the Layers button. */
.prospect-draw-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px 10px; max-width: min(640px, calc(100vw - 60px)); }
.prospect-draw-tools { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: var(--card); box-shadow: 0 1px 6px rgba(0,0,0,.2); }
.prospect-draw-tools[hidden] { display: none; }
.prospect-follow-streets { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 12px; background: var(--card); box-shadow: 0 1px 6px rgba(0,0,0,.2); font-size: .85rem; cursor: pointer; }
.prospect-new-territory { padding: 14px 16px; border: 2px solid var(--purple-600); }
.prospect-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; flex-basis: 100%; margin: 0; padding: 8px 0 0; border: 0; }
.prospect-checks legend { padding: 0; margin-bottom: 4px; }
.prospect-shape-tools { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.prospect-shape-tools p { flex-basis: 100%; margin: 4px 0 0; }
.link-button.danger { color: #B91C1C; }
.prospect-checks .check { min-height: 32px; }
.prospect-color input[type=color] { width: 56px; min-height: var(--touch); padding: 2px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); cursor: pointer; }
.prospect-off .job-title, .prospect-admin-row.off .grow { opacity: .6; }
.prospect-admin-list { padding: 4px 14px; margin-bottom: 16px; }
.prospect-admin-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.prospect-admin-row:last-child { border-bottom: 0; }
.prospect-admin-row .grow { flex: 1; }
.prospect-admin-row .inline-form { margin-top: 0; flex: 1 1 320px; }
.prospect-admin-row.off .prospect-status-form { opacity: .6; }
.prospect-move { display: flex; flex-direction: column; }
.prospect-move .link-button { min-height: 24px; text-decoration: none; font-size: 12px; padding: 0 6px; }
.prospect-move .link-button:disabled { opacity: .25; cursor: default; }
.prospect-key-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.prospect-biz { margin-left: 6px; vertical-align: 1px; font-size: 11px; }
.prospect-biz-switch > span:last-child { display: flex; align-items: center; gap: 6px; min-height: 38px; font-weight: 400; }
.prospect-admin-add { padding: 14px 16px; margin-top: 16px; }
@media (max-width: 700px) {
  .prospect-territory-map { height: 60dvh; min-height: 320px; }
  .prospect-key-code { flex-basis: 100%; }
}

/* ---------- Prospect: reps' field app (prospect-app/, its js/prospect-knock.js) ----------
   A full-screen map; the bar, buttons and bottom sheet float over it, clear of the notch and home bar. */
body.knock { overflow: hidden; overscroll-behavior: none; background: var(--purple-900); }
.knock-app { position: fixed; inset: 0; }
.knock-map { position: absolute; inset: 0; background: var(--bg); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* Press and hold to drop a pin: a ring fills under the finger, then the "Drop here" pin sits on the spot. */
.knock-hold {
  position: fixed; z-index: 6; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%; pointer-events: none;
  border: 4px solid var(--purple-600); background: rgba(107,47,163,.15); animation: knock-hold linear forwards;
}
@keyframes knock-hold { from { transform: scale(.3); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.knock-drop { position: absolute; width: 0; height: 0; }
.knock-drop-pin { position: absolute; left: -20px; top: -50px; display: block; } /* prospect-pins.js art: the tip is at 40/44 of its height */
/* Every status springs out of the pin into a circle around its head (--x/--y set by the script), then floats. */
.knock-bloom {
  position: absolute; left: calc(var(--x) - 24px); top: calc(var(--y) - 52px); width: 48px; padding: 0; border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px; font: inherit; cursor: pointer;
  animation: knock-bloom .42s cubic-bezier(.34, 1.56, .64, 1) var(--d) backwards, knock-float 2.6s ease-in-out calc(var(--d) + .45s) infinite alternate;
}
.knock-bloom-dot {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--c); color: #fff;
  box-shadow: 0 0 0 3px #fff, 0 8px 18px rgba(0,0,0,.3);
}
.knock-bloom:active .knock-bloom-dot { transform: scale(.92); }
/* Wider than the dot and centered under it; long labels ("Request for Proposal") take two lines. */
.knock-bloom-label {
  width: max-content; max-width: 78px; padding: 2px 6px; border-radius: 9px; background: rgba(255,255,255,.96); color: var(--text);
  font-size: 11px; font-weight: 700; line-height: 1.15; text-align: center; white-space: normal; box-shadow: 0 1px 5px rgba(0,0,0,.22);
}
@keyframes knock-bloom { from { transform: translate(calc(-1 * var(--x)), calc(-1 * var(--y))) scale(.2); opacity: 0; } }
@keyframes knock-float { to { transform: translateY(-3px); } }
/* A door picked up: the pin floats above its landing spot (the shadow) and follows the finger, like a lifted pegman. */
.knock-lift-shadow {
  /* Like the pegman: a big soft shadow on the ground where the lifted pin will land. */
  position: fixed; z-index: 7; width: 40px; height: 14px; margin: -7px 0 0 -20px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.55), rgba(0,0,0,.25) 45%, rgba(0,0,0,0) 72%); filter: blur(1px);
}
.knock-lift {
  position: fixed; z-index: 8; pointer-events: none; transform: translate(-50%, calc(-100% - 22px)) scale(1.6); transform-origin: 50% 100%;
  filter: drop-shadow(0 10px 10px rgba(0,0,0,.35)); animation: knock-lift .18s ease-out, knock-hover 1.2s ease-in-out .18s infinite alternate;
}
.knock-lift svg { display: block; }
@keyframes knock-lift { from { transform: translate(-50%, -100%) scale(1); } }
@keyframes knock-hover { to { transform: translate(-50%, calc(-100% - 28px)) scale(1.6); } }
.knock-trash {
  position: fixed; z-index: 6; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center; align-content: center; gap: 1px; background: rgba(28,23,38,.88); color: #fff; font-size: 11px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(0,0,0,.35); pointer-events: none;
  transform: translate(-50%, 160%); transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), background .15s;
}
body.lifting .knock-trash { transform: translate(-50%, 0); }
body.lifting .knock-trash.hot { transform: translate(-50%, 0) scale(1.3); background: #DC2626; }
body.lifting .knock-fabs, body.lifting .knock-toast { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .knock-bloom, .knock-lift { animation: none; } }
.knock-drop svg { display: block; margin-bottom: -3px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
.knock-lift img { display: block; }
.knock-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 8px) var(--safe-right) 8px var(--safe-left);
  background: var(--purple-900); color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.2);
}
.knock-status { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.knock-status strong { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.knock-status .knock-sub { color: var(--purple-100); }
.knock-sub { font-size: 13px; color: var(--muted); }
.knock-toggle { flex: none; min-width: 84px; }
body.knocking .knock-bar { background: #1E5631; }
body.knocking .knock-status strong { font-family: var(--font-num); font-weight: 500; }
.knock-round {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: var(--touch); height: var(--touch);
  border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: inherit; cursor: pointer; text-decoration: none;
}
.knock-fabs .knock-round { background: var(--card); color: var(--purple-700); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.knock-fabs .knock-round.on { color: #1A73E8; }
/* The locate button's next zoom: + closes in on the houses here, − steps out to the nearby streets. */
#knock-locate { position: relative; }
#knock-locate[data-next]::after {
  position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%; background: var(--purple-700); color: #fff;
  font: 700 14px/18px system-ui, sans-serif; text-align: center; box-shadow: 0 0 0 2px var(--card);
}
#knock-locate[data-next="in"]::after { content: '+'; }
#knock-locate[data-next="out"]::after { content: '−'; }
.knock-round.flat { background: transparent; color: var(--muted); }
.knock-notices {
  position: absolute; z-index: 2; left: var(--safe-left); right: var(--safe-right);
  top: calc(env(safe-area-inset-top) + 72px); display: grid; gap: 6px; pointer-events: none;
}
.knock-notice { margin: 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--border); font-size: 13px; box-shadow: 0 1px 6px rgba(0,0,0,.12); pointer-events: auto; }
.knock-notice.warn { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.knock-fabs {
  position: absolute; z-index: 2; right: var(--safe-right); bottom: calc(env(safe-area-inset-bottom) + 20px);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.knock-add {
  display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; border: 0;
  background: var(--purple-600); color: #fff; box-shadow: 0 4px 14px rgba(46,18,72,.45); cursor: pointer;
}
.knock-add:active { background: var(--purple-700); }
body.sheet-open .knock-fabs, body.searching .knock-fabs { display: none; }
/* Search (the magnifier): a panel under the top bar with the box and the matching doors. */
.knock-search {
  position: absolute; z-index: 4; left: var(--safe-left); right: var(--safe-right); top: calc(env(safe-area-inset-top) + 66px);
  display: grid; grid-template-rows: auto minmax(0, 1fr); max-height: calc(100% - env(safe-area-inset-top) - 90px);
  background: var(--card); border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.3); overflow: hidden;
}
.knock-search[hidden] { display: none; }
.knock-search-bar { display: flex; align-items: center; gap: 4px; padding: 8px 6px 8px 12px; border-bottom: 1px solid var(--border); margin: 0; }
.knock-search-bar input { flex: 1; min-width: 0; min-height: var(--touch); border: 0; background: transparent; font: inherit; font-size: 17px; color: var(--text); outline: none; }
.knock-search-list { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; }
.knock-search-list > li.knock-sub { padding: 10px 14px; }
.knock-search-hit {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 14px; border: 0;
  background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.knock-search-hit:active { background: var(--bg); }
.knock-search-hit > span:last-child { display: grid; min-width: 0; }
.knock-search-hit strong, .knock-search-hit .knock-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knock-search-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.knock-search-dot.go { background: var(--purple-600); }
/* My leads (the phone app's menu): the search panel with quick filters, and a JobTread button on each lead in JobTread. */
.knock-leads-title { flex: 1; font-size: 17px; }
.knock-leads-filters { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.knock-leads-filters::-webkit-scrollbar { display: none; }
.knock-leads-chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.knock-leads-chip.on { background: var(--purple-600); border-color: var(--purple-600); color: #fff; }
.knock-leads-row { display: flex; align-items: center; padding-right: 10px; }
.knock-leads-row .knock-search-hit { flex: 1; min-width: 0; }
.knock-leads-jt { flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px; background: var(--purple-50); color: var(--purple-700); font-size: 13px; font-weight: 700; text-decoration: none; }
.knock-leads-jt.warn { background: var(--warn-bg); color: var(--warn-text); }
button.knock-leads-jt { border: 0; font-family: inherit; cursor: pointer; }
.knock-leads-jt.busy { background: transparent; color: var(--muted); font-weight: 600; }
.knock-leads-err { color: var(--warn-text); }
.knock-toast {
  position: absolute; z-index: 5; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 100px);
  width: max-content; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: rgba(28,23,38,.92); color: #fff; font-size: 14px; text-align: center;
}
body.sheet-open .knock-toast { bottom: auto; top: calc(env(safe-area-inset-top) + 76px); }
.knock-toast-action { margin-left: 14px; min-height: 32px; padding: 0 4px; border: 0; background: none; color: #E9D5FF; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.knock-sheet {
  position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; max-height: 86dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 6px var(--safe-right) 0 var(--safe-left);
  background: var(--card); border-radius: 18px 18px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,.2);
}
.knock-sheet.busy { opacity: .7; pointer-events: none; }
/* Request for Proposal / Sold without a contact: the boxes still to fill. */
.knock-input.missing { border-color: #DC2626; box-shadow: 0 0 0 2px rgba(220,38,38,.18); }
.knock-sheet { transform-origin: 50% 50%; will-change: transform; }
.knock-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto 8px; }
.knock-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.knock-addr { flex: 1; min-width: 0; display: grid; gap: 2px; }
.knock-addr-line { font-weight: 700; }
.knock-sheet-head > div { min-width: 0; }
.knock-links { display: flex; gap: 8px; margin: 8px 0 0; }
.knock-link { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: 999px; background: var(--purple-50); color: var(--purple-700); font-weight: 600; text-decoration: none; }
/* The 7 statuses in two rows of four, no sideways scrolling: long labels wrap inside their chip. */
.knock-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 2px 0 6px; }
.knock-chips .prospect-chip { min-height: 40px; padding: 2px 3px; border-radius: 12px; font-size: 12px; line-height: 1.15; text-align: center; overflow-wrap: anywhere; }
.knock-name-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.knock-biz { display: flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; color: var(--muted); }
.knock-biz input { width: 18px; height: 18px; margin: 0; accent-color: var(--purple-600); }
.knock-biz:has(input:checked) { color: var(--purple-700); border-color: var(--purple-600); background: var(--purple-50); }
.knock-tabs { display: flex; gap: 6px; margin: 12px 0 10px; }
.knock-tabs .pill { min-height: 40px; }
.knock-form { display: grid; gap: 8px; }
.knock-fields { display: grid; gap: 8px; }
.knock-fields[hidden] { display: none; }
.knock-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* 16px text so iPhone doesn't zoom in on focus. */
.knock-input {
  width: 100%; min-width: 0; min-height: 38px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 16px; color: var(--text); background: var(--card); box-sizing: border-box;
}
textarea.knock-input { resize: none; line-height: 1.35; }
.knock-sheet-foot {
  position: sticky; bottom: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 calc(-1 * var(--safe-right)) 0 calc(-1 * var(--safe-left));
  padding: 8px var(--safe-right) calc(env(safe-area-inset-bottom) + 10px) var(--safe-left); background: var(--card); border-top: 1px solid var(--border);
}
.knock-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.knock-grid .wide { grid-column: 1 / -1; }
.knock-field { display: grid; gap: 3px; font-size: 13px; color: var(--muted); font-weight: 600; min-width: 0; }
.knock-field input, .knock-field textarea {
  width: 100%; min-height: var(--touch); padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 16px; font-weight: 400; color: var(--text); background: var(--card);
}
.knock-field textarea { resize: vertical; }
.knock-save { min-width: 140px; }
@media (min-width: 700px) {
  .knock-sheet { left: auto; right: 16px; bottom: 16px; width: 420px; border-radius: var(--radius); }
}

/* Takeoffs list: one stacked row per bid (job, chips, links | facts); facts wrap under the job on phones. */
.takeoff-list { list-style: none; margin: 0; padding: 0; }
.takeoff-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 8px 24px; padding: 14px 0; border-bottom: 1px solid var(--border, #E3DDEB); }
.takeoff-row:last-child { border-bottom: 0; }
.takeoff-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.takeoff-links { display: flex; flex-wrap: wrap; gap: 0 12px; margin-top: 2px; }
.takeoff-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px 16px; margin: 0; align-content: start; }
.takeoff-facts dt { font-size: 12px; color: var(--muted, #5E566B); text-transform: uppercase; letter-spacing: .04em; }
.takeoff-facts > div { min-width: 0; }
.takeoff-facts > .wide { grid-column: span 2; }   /* the Claude account email */
.takeoff-facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
@media (max-width: 760px) { .takeoff-row { grid-template-columns: 1fr; } }

/* Takeoff detail: status chips use the takeoff markup colours (green contract, yellow assumed, orange alt/RFI, gray not in contract). */
.chip.st-contract { background: #D6F0DD; color: #1E5631; }
.chip.st-assumed { background: #FFF4CC; color: #6B5300; }
.chip.st-alt { background: #FDE3CC; color: #9A3412; }
.chip.st-not { background: #E5E5E5; color: #444; }
.takeoff-head h2 { margin: 0; font-size: 22px; overflow-wrap: anywhere; }
.takeoff-head { padding: 18px 20px; }
.takeoff-head .takeoff-facts { margin-top: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px 24px; }
.takeoff-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; }
.takeoff-docs { list-style: none; margin: 0; padding: 0; }
.takeoff-docs li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.takeoff-docs li:last-child { border-bottom: 0; }
.share-url { flex: 1 1 260px; min-width: 0; min-height: var(--touch); padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; font-size: 14px; color: var(--text); background: var(--bg); }
.takeoff-docs li.share-new { background: #F3ECFA; border-radius: 8px; padding-left: 8px; padding-right: 8px; }
#share form { display: inline; }
#share > form { display: block; margin-top: 10px; }
.budget-assumptions { margin-top: 10px; }
.budget-assumptions summary { cursor: pointer; min-height: var(--touch); display: flex; align-items: center; color: var(--purple-700); }
a.chip-link { text-decoration: none; cursor: pointer; }
a.chip-link:hover { text-decoration: underline; }
.proposal-line + .proposal-line { margin-top: 2px; }
.boq-lines summary { cursor: pointer; margin: 12px 0 4px; font-weight: 600; min-height: var(--touch); display: flex; align-items: center; }

/* Takeoffs → Queue: line number in front of each waiting takeoff. */
.takeoff-queue { padding: 0; }
.queue-no { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; border-radius: 12px; background: var(--purple-600); color: #fff; font-size: 13px; font-weight: 600; }

/* ---------- Website > Visitors (Pages/Website/Visitors.cshtml, wwwroot/js/website-visitors.js) ---------- */
.wv-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.wv-head > div { flex: 1 1 320px; }
.wv-head h2 { margin: 0 0 2px; }
.wv-day { display: grid; gap: 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.wv-day input { min-height: var(--touch); font: inherit; font-size: 15px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.wv-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; align-items: start; }
@media (max-width: 900px) { .wv-layout { grid-template-columns: minmax(0, 1fr); } }
.wv-stage { padding: 12px; min-width: 0; }
.wv-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.wv-controls select { min-height: 36px; font: inherit; }
.wv-controls input[type=range] { flex: 1 1 160px; accent-color: var(--purple-600); }
.wv-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0; color: var(--muted); }
.wv-legend span { display: inline-flex; align-items: center; gap: 4px; }
#wv-tree, .wv-tree { position: relative; width: 100%; height: min(72vh, 680px); min-height: 380px; overflow: hidden; border-radius: var(--radius-sm); background: linear-gradient(#f7f4fb, #fff); touch-action: none; }
.wv-tree canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.wv-labels { position: absolute; inset: 0; pointer-events: none; }
.wv-tag { position: absolute; left: 0; top: 0; font-size: 11px; color: var(--muted); white-space: nowrap; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.wv-tag-section { font-size: 12px; font-weight: 700; color: var(--text); }
.wv-tag-hot::after { content: " " attr(data-count); font-family: var(--font-num); color: var(--purple-700); }
.wv-tip { position: absolute; padding: 4px 8px; background: var(--text); color: #fff; font-size: 12px; border-radius: 6px; pointer-events: none; white-space: nowrap; }
.wv-g-search { --wv-c: #2F6DB5; } .wv-g-ads { --wv-c: #C2861A; } .wv-g-social { --wv-c: #C2417A; }
.wv-g-direct { --wv-c: #6B6577; } .wv-g-ai { --wv-c: #138A80; } .wv-g-other { --wv-c: #6B2FA3; }
.wv-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--wv-c); flex: none; }
.wv-ring { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 3px solid; box-sizing: border-box; }
.wv-ring.wv-o-lead { border-color: #1E8C45; } .wv-ring.wv-o-contact { border-color: #E0A100; }
.wv-list { padding: 12px; max-height: 80vh; overflow: auto; }
.wv-list h3 { margin: 0 0 8px; }
#wv-visits { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wv-item { width: 100%; text-align: left; display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); font: inherit; color: inherit; cursor: pointer; min-height: var(--touch); }
.wv-item:hover, #wv-visits li.is-on .wv-item { border-color: var(--purple-600); background: var(--purple-50); }
.wv-item-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wv-item-top .chip { margin-left: auto; }
.wv-trail { color: var(--text); overflow-wrap: anywhere; }

/* ---------- Sales > Ads: one card per ad campaign with its health bar ---------- */
.ad-list { display: grid; gap: 8px; min-width: 0; margin-bottom: 8px; }
.ad-list[hidden] { display: none; }
.ad-cards-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ad-cards-head .section-title { margin: 0; }
.ad-card { padding: 12px 14px; display: grid; gap: 10px; min-width: 0; border-left: 5px solid var(--p); --p: var(--purple-600); }
/* Platform colour: the card's left edge and its health bar. The bar goes from pale (low score) to full colour (high). */
.ad-card.ad-c-google { --p: #2F6DB5; }
.ad-card.ad-c-lsa { --p: #138A80; }
.ad-card.ad-c-meta { --p: #4F5BD5; }
.ad-card.ad-c-bing { --p: #0E86A8; }
.ad-card.ad-c-nextdoor { --p: #3F8A26; }
.ad-card.ad-c-other { --p: #8A6FB0; }
.ad-head { display: flex; gap: 12px; align-items: center; min-width: 0; }
.ad-platform { flex: none; min-width: 96px; text-align: center; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--purple-50); color: var(--purple-700); }
.ad-p-google { background: #DCE9FB; color: #1B4C86; }
.ad-p-lsa { background: #D5F0EC; color: #0B5750; }
.ad-p-meta { background: #E3E6FB; color: #2F3A8F; }
.ad-p-bing { background: #D9F0F7; color: #0B5568; }
.ad-p-nextdoor { background: #E2F3DA; color: #2D5A1B; }
.ad-main { min-width: 0; display: grid; gap: 2px; }
.ad-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-sub { font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.ad-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px 12px; margin: 0; }
.ad-figs > div { min-width: 0; }
.ad-figs dt { font-size: 12px; color: var(--muted); }
.ad-figs dd { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; }
.ad-health { display: grid; gap: 4px; --h: var(--purple-600); --h-bg: var(--purple-50); --h-text: var(--purple-700); }
.ad-health-top { display: flex; align-items: baseline; gap: 8px; }
.ad-health-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ad-health-score { font-size: 18px; font-weight: 700; color: var(--h-text); }
.ad-health-state { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--h-bg); color: var(--h-text); }
.ad-bar { height: 8px; border-radius: 4px; background: #ECE8F1; overflow: hidden; }
.ad-bar > span { display: block; height: 100%; border-radius: 4px; background: color-mix(in srgb, var(--p) calc(25% + var(--score, 50) * 0.75%), #FFFFFF); }
.ad-reason { margin: 0; font-size: 13px; }
.ad-note { margin: 0; }
.ad-h-strong { --h: #2E7D4F; --h-bg: var(--good-bg); --h-text: var(--good-text); }
.ad-h-ok { --h: var(--purple-600); --h-bg: var(--purple-50); --h-text: var(--purple-700); }
.ad-h-watch { --h: #D97706; --h-bg: #FEF3C7; --h-text: #8A4B00; }
.ad-h-poor { --h: #C2410C; --h-bg: var(--warn-bg); --h-text: var(--warn-text); }
.ad-h-learning { --h: #A98BD2; --h-bg: #F4EFFB; --h-text: #5F4385; }
.ad-h-learning .ad-bar > span { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--p) 55%, #FFFFFF) 0 6px, color-mix(in srgb, var(--p) 25%, #FFFFFF) 6px 12px); }
.ad-h-none { --h: #A3A1AB; --h-bg: #ECEBEF; --h-text: #52505B; }
@media (max-width: 520px) {
  .ad-head { align-items: flex-start; flex-direction: column; gap: 6px; }
  .ad-platform { min-width: 0; }
  .ad-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
