:root {
  --white: #fff;
  --canvas: #f7f8f6;
  --rail: #f4f6f3;
  --ink: #10231f;
  --text: #3c4a46;
  --teal: #123e3d;
  --teal-hover: #1c5553;
  --muted: #66736e;
  --line: #dde2dd;
  --field: #d5dcd6;
  --success: #1c5c40;
  --warning: #7a5512;
  --error: #963c31;
  --radius: 8px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-family: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
a { color: var(--teal); text-underline-offset: 3px; }
a:hover { color: var(--teal-hover); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.1; letter-spacing: -.8px; font-weight: 600; }
h2 { font-size: 23px; line-height: 1.25; letter-spacing: -.5px; font-weight: 600; }
h3 { font-size: 18px; line-height: 1.35; letter-spacing: -.3px; font-weight: 600; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
summary:focus-visible { outline: 3px solid #79a99c; outline-offset: 3px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip-path: inset(50%) !important; white-space: nowrap !important; border: 0 !important; }
.skip-link { position: absolute; top: -60px; left: 16px; padding: 9px 15px; border-radius: var(--radius); background: white; z-index: 100; }
.skip-link:focus { top: 10px; }

.app-header { min-height: 58px; display: flex; align-items: center; gap: 28px; padding: 0 24px; background: var(--white); border-bottom: 1px solid #e3e7e2; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); font-weight: 600; font-size: 16px; letter-spacing: -.2px; text-decoration: none; white-space: nowrap; }
.brand-icon { display: block; width: 26px; height: 26px; flex: none; object-fit: contain; border-radius: 7px; }
.app-header nav { display: flex; align-items: center; gap: 4px; }
.nav-item { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; color: var(--muted); padding: 7px 14px; font-size: 14px; border-radius: 7px; white-space: nowrap; }
.nav-item:hover { background: #f1f4f0; color: var(--teal); }
.nav-item.active { background: #eef2ee; color: var(--teal); font-weight: 600; }
.local-label { margin-left: auto; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--muted); border: 1px solid #e3e7e2; padding: 5px 10px; border-radius: 20px; text-transform: uppercase; white-space: nowrap; }
.session-controls { margin: 0 0 0 auto; }
.session-controls .nav-item { font-size: 12px; border: 1px solid var(--line); }
.count { font-family: var(--mono); font-size: 11px; font-weight: 400; background: var(--teal); color: white; padding: 1px 5px; border-radius: 20px; }
.app-layout { min-height: calc(100dvh - 58px); }
main { padding: 26px 24px 30px; min-width: 0; max-width: 1800px; margin: 0 auto; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.intro p { margin-top: 8px; color: var(--muted); font-size: 14px; max-width: 800px; }
.metrics { display: flex; flex-wrap: wrap; gap: 0 5px; margin-top: 7px; color: var(--muted); font-size: 14px; }
.metrics strong { font-weight: 400; }
.metrics > div { display: inline; }
.metrics > div:not(:last-child)::after { content: " · "; margin-left: 4px; }
.page-actions, .button-row { display: flex; align-items: center; gap: 8px; }
.page-actions { flex-shrink: 0; }
.page-actions svg { width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 1.5; }
#discovery-toggle[aria-expanded=true] svg { transform: rotate(180deg); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; border: 1px solid #c3cdc7; background: var(--white); padding: 8px 14px; border-radius: var(--radius); color: var(--ink); font-weight: 500; font-size: 14px; line-height: 1.35; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.button:hover:not(:disabled) { border-color: var(--teal); background: #f8faf7; color: var(--ink); }
.button.primary { background: var(--teal); border-color: var(--teal); color: var(--white); font-weight: 600; }
.button.primary:hover:not(:disabled) { background: var(--teal-hover); border-color: var(--teal-hover); color: white; }
.button.danger { color: var(--error); border-color: #dec3bc; }
.full { width: 100%; }
.text-button { border: 0; background: none; color: var(--teal); font-size: 13px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; padding: 3px 0; }
.text-button:hover { color: var(--teal-hover); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-heading h2 { display: flex; align-items: center; gap: 9px; }

/* Discovery is a compact workbench panel, becoming a sheet on small screens. */
.discovery-panel { background: var(--white); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 20px; overflow: hidden; }
.discovery-heading { display: none; }
.discovery-close { display: none; }
#discover-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 300px; }
.discovery-locations, .discovery-categories, .discovery-controls { padding: 18px 20px; min-width: 0; }
.discovery-locations, .discovery-categories { border-right: 1px solid #eef1ee; }
.discovery-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.discovery-section-heading h3 { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 400; color: var(--muted); }
.discovery-section-heading .field { margin: 0 !important; }
.discovery-section-heading #location-group { max-width: 100%; }
.discovery-controls { background: #fbfcfb; display: flex; flex-direction: column; gap: 12px; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { display: block; font-size: 13px; font-weight: 600; margin-bottom: 9px; }
.discovery-panel legend, .discovery-label { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; font-weight: 400; margin-bottom: 12px; }
.discovery-panel .location-heading, .discovery-locations .field { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.discovery-locations .field { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.discovery-locations .field select, #location-group { width: auto; max-width: 75%; min-height: 30px; padding: 4px 8px; font-family: "Instrument Sans", sans-serif; font-size: 13px; letter-spacing: 0; text-transform: none; background: #fbfcfb; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); }
.choice-list { display: flex; flex-wrap: wrap; gap: 7px; }
.choice { display: inline-flex; align-items: center; gap: 7px; position: relative; cursor: pointer; line-height: 1.4; font-size: 13px; min-height: 33px; color: var(--text); border: 1px solid var(--field); border-radius: 22px; padding: 6px 11px; background: var(--white); }
.choice input { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
.choice:has(input:checked) { background: var(--teal); border-color: var(--teal); color: white; }
.choice:has(input:checked)::after { content: ""; width: 9px; height: 9px; flex: none; background: linear-gradient(45deg, transparent 43%, currentColor 43% 57%, transparent 57%), linear-gradient(-45deg, transparent 43%, currentColor 43% 57%, transparent 57%); }
.choice:has(input:focus-visible) { outline: 3px solid #79a99c; outline-offset: 3px; }
.choice:hover { border-color: var(--teal); }
#locations-more { display: inline-flex; align-items: center; min-height: 33px; padding: 6px 4px; font-size: 13px; margin-top: 4px; }
.discovery-categories > p, .discovery-categories .small, #provider-note { font-size: 12px; line-height: 1.5; color: var(--muted); margin-top: 14px; }
.discovery-categories > .text-button { margin-top: 9px; font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-size: 13px; font-weight: 500; min-width: 0; }
.field input, .field select, .field textarea, .filters select, .search-field { width: 100%; border: 1px solid var(--field); border-radius: var(--radius); background: var(--white); color: var(--ink); min-height: 40px; padding: 8px 11px; font-weight: 400; }
.field input::placeholder, .field textarea::placeholder { color: #85908b; }
.field textarea { resize: vertical; }
.field input[type=file] { padding: 11px; font-size: 13px; }
.field input[type=file]::file-selector-button { border: 1px solid var(--field); border-radius: 5px; background: var(--rail); color: var(--ink); font: inherit; padding: 4px 9px; margin-right: 10px; cursor: pointer; }
.discovery-controls .field { margin-bottom: 0; gap: 5px; font-size: 12px; color: var(--muted); }
.discovery-controls .field input, .discovery-controls .field select { min-height: 35px; padding: 7px 8px; font-size: 13px; border-radius: 7px; }
.discovery-controls .form-row { grid-template-columns: minmax(0, 1fr) 76px; gap: 10px; }
.discovery-controls .enrich-choice { margin: 0; }
.enrich-choice { border: 0; border-radius: 0; background: transparent !important; color: var(--text) !important; padding: 0; min-height: 24px; gap: 9px; }
.enrich-choice:has(input:checked)::after { content: none; }
.enrich-choice input, input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--teal); flex: none; margin: 0; cursor: pointer; }
.enrich-choice input { position: static; clip-path: none; }
.discovery-controls .maps-search { border: 0; background: none; min-height: 20px; padding: 0; text-decoration: underline; font-size: 12.5px; color: var(--teal); font-weight: 400; }
.maps-search { text-align: center; }
.discovery-controls > .button.primary { min-height: 40px; }
.discovery-backdrop { display: none; }

/* Workbench filters, bulk actions and lead rows. */
.filters { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-width: 0; }
.search-field { display: flex; align-items: center; gap: 10px; padding: 0 13px; min-height: 40px; flex: 1 1 250px; min-width: 170px; }
.search-field svg { width: 17px; height: 17px; stroke: #6b7873; stroke-width: 1.9; fill: none; flex: none; }
.search-field input { border: 0; background: none; width: 100%; min-width: 0; min-height: 38px; outline: none; color: var(--ink); font-size: 14px; }
.search-field:focus-within { outline: 3px solid #79a99c; outline-offset: 2px; }
.search-field input:focus-visible { outline: none; }
.search-field input::placeholder { color: var(--muted); opacity: 1; }
.filters select { flex: 0 0 auto; width: auto; min-height: 40px; font-size: 13px; padding: 0 10px; }
.filter-tabs { display: flex; align-items: center; gap: 2px; background: #eef1ee; padding: 4px; border-radius: 9px; flex-shrink: 0; overflow-x: auto; }
.filter-tabs button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--muted); font-size: 13px; padding: 7px 10px; line-height: 1.35; border-radius: 6px; white-space: nowrap; }
.filter-tabs button:hover { color: var(--ink); }
.filter-tabs button.active, .filter-tabs button[aria-pressed=true], .filter-tabs button[aria-selected=true] { background: var(--white); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px #10231f14; }
.filter-count { font-weight: inherit; }
.table-frame { border: 1px solid var(--line); background: var(--white); border-radius: 12px; overflow: hidden; min-width: 0; }
.bulk-toolbar { display: flex; align-items: center; gap: 14px; min-height: 50px; padding: 10px 18px; background: #f4f6f3; border-bottom: 1px solid #e6eae6; }
.bulk-toolbar .button { min-height: 28px; border-radius: 6px; font-size: 12px; padding: 5px 11px; }
#selection-count, .selection-count, #result-count { font-family: var(--mono); font-size: 11px; letter-spacing: .05em; color: var(--muted); text-transform: uppercase; }
.bulk-toolbar #result-count { margin-left: auto; white-space: nowrap; letter-spacing: 0; }
table { width: 100%; table-layout: fixed; border-collapse: collapse; text-align: left; font-size: 13px; }
th { color: var(--muted); font-family: var(--mono); font-size: 10.5px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; padding: 9px 10px; border-bottom: 1px solid #eef1ee; }
td { padding: 16px 10px; border-bottom: 1px solid #eef1ee; vertical-align: middle; color: var(--text); overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbf9; }
tbody tr.selected { background: #f1f6f1; }
th:first-child, .select-cell { width: 44px; padding-left: 18px; padding-right: 10px; }
th:nth-child(2) { width: 25%; }
th:nth-child(3) { width: 11%; }
th:nth-child(4) { width: 24%; }
th:nth-child(5) { width: 20%; }
th:last-child { width: 16%; }
th:last-child, .status-cell { text-align: right; padding-right: 18px; }
.business-link { display: inline; background: none; border: 0; font-weight: 600; font-size: 14px; color: var(--ink); padding: 0; text-align: left; text-decoration: none; max-width: 100%; line-height: 1.4; overflow-wrap: anywhere; }
.business-link:hover { color: var(--teal); text-decoration: underline; }
.subline { display: block; color: #6b7873; font-size: 11px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; }
.lead-cell .subline { font-size: 12px; }
.contacts-cell > span:first-child, .contacts-cell > a:first-child { display: block; font-family: var(--mono); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.research-cell { font-size: 12.5px; }
.research-cell .subline { white-space: nowrap; }
.region-cell { font-size: 13px; overflow-wrap: normal; }
.person-badge { display: inline-block; margin-left: 7px; font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; vertical-align: middle; }
.person-type { margin-top: 5px; font-family: var(--mono); font-size: 9px !important; text-transform: uppercase; letter-spacing: .06em; padding: 2px 6px !important; border: 1px solid var(--line); border-radius: 4px !important; background: transparent !important; }
.mono { font-family: var(--mono); }
.management-count { color: var(--teal); }
.status { display: inline-block; font-size: 11.5px; line-height: 1.35; font-weight: 500; padding: 4px 10px; border-radius: 20px; color: #5c6a66; background: #eef1ee; text-align: center; white-space: nowrap; }
.status.ready, .status.completed, .status.published { background: #e4efe7; color: var(--success); }
.status.failed, .status.error, .status.excluded, .status.suppressed { color: var(--error); background: #f7e8e2; }
.status.running, .status.queued, .status.partial, .status.review { color: var(--warning); background: #f6efdc; }
.empty-state, .loading-state, .connection-state { min-height: 310px; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; padding: 50px 28px; }
.empty-state svg { width: 57px; height: 57px; stroke: #9fb3ac; stroke-width: 2; fill: none; margin-bottom: 20px; }
.empty-state h3, .connection-state h3 { font-size: 20px; letter-spacing: -.3px; }
.empty-state p, .loading-state p, .connection-state p { color: var(--muted); margin-top: 10px; font-size: 14px; max-width: 460px; line-height: 1.55; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 20px; }
.connection-state { min-height: 210px; background: #fffcf7; }
.connection-state .button { margin-top: 18px; }
.connection-state svg { width: 32px; height: 32px; stroke: var(--warning); fill: none; margin-bottom: 14px; }
.loading-state { color: var(--muted); align-items: stretch; justify-content: flex-start; text-align: left; padding: 18px; }
.loading-state > span { font-family: var(--mono); font-size: 11px; padding-bottom: 10px; }
.loading-state > div { min-height: 65px; border-bottom: 1px solid #eef1ee; background: linear-gradient(#eaeeea 0 0) 0 center / 16px 16px, linear-gradient(#eaeeea 0 0) 6% center / 24% 10px, linear-gradient(#eff2ef 0 0) 40% center / 10% 10px, linear-gradient(#eff2ef 0 0) 66% center / 21% 10px, linear-gradient(#eff2ef 0 0) 100% center / 14% 22px; background-repeat: no-repeat; }
.loading-state > div:last-child { border-bottom: 0; }
.skeleton-row { display: grid; grid-template-columns: 20px 2fr 1fr 2fr 1fr; gap: 20px; padding: 20px 18px; border-bottom: 1px solid #eef1ee; }
.skeleton-row span { display: block; height: 11px; background: #eaeeea; border-radius: 20px; }
footer { margin-top: 18px; color: #6b7873; font-size: 11.5px; line-height: 1.6; }
.notice { padding: 12px 15px; border: 1px solid #bad0be; border-radius: 9px; color: var(--success); background: #edf5ed; margin-bottom: 20px; font-size: 13px; overflow-wrap: anywhere; }
.notice.error { background: #fff3ee; border-color: #e8c4b7; color: var(--error); }
.connection-notice { color: var(--error); }
.active-job { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid var(--line); border-left: 3px solid var(--teal); border-radius: 10px; padding: 12px 16px; background: var(--white); margin-bottom: 20px; font-size: 13px; }
.active-job > div:first-child { min-width: 0; }
.active-job progress { max-width: 340px; margin-top: 7px; }
.active-job .button-row { margin-left: auto; flex-shrink: 0; }

/* Activity and export exclusions use the same quiet surface hierarchy. */
.jobs-list { margin-top: 26px; display: grid; gap: 14px; }
.job-row { padding: 20px; border: 1px solid var(--line); background: var(--white); border-radius: 12px; }
.job-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.job-heading h2 { font-size: 17px; letter-spacing: -.2px; }
.job-row p { color: var(--muted); margin-top: 8px; font-size: 13px; }
.job-row .job-settings { font-size: 12px; overflow-wrap: anywhere; }
.job-row .job-errors { color: var(--error); white-space: pre-wrap; overflow-wrap: anywhere; }
.job-row .button { margin-top: 12px; min-height: 34px; font-size: 13px; }
progress { display: block; width: 100%; height: 5px; margin-top: 14px; border: 0; border-radius: 20px; background: #eaeeea; accent-color: var(--teal); overflow: hidden; }
progress::-webkit-progress-bar { background: #eaeeea; border-radius: 20px; }
progress::-webkit-progress-value { background: var(--teal); border-radius: 20px; }
progress::-moz-progress-bar { background: var(--teal); border-radius: 20px; }
.job-previous-attempt { margin-top: 12px; font-size: 13px; }
.job-previous-attempt summary { cursor: pointer; color: var(--teal); width: fit-content; }
.exclusions-content { margin-top: 26px; max-width: 820px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.exclusions-content h2 { font-size: 18px; }
.exclusions-content p { font-size: 13px; margin: 8px 0 21px; max-width: 640px; }
.exclusions-content form { display: flex; align-items: flex-end; gap: 10px; max-width: 610px; }
.exclusions-content form .field { flex: 1; margin: 0; }
.exclusions-content form .button { min-height: 40px; }
.suppression-list { padding: 0; list-style: none; margin: 22px 0 0; }
.suppression-list li { display: flex; align-items: center; justify-content: space-between; gap: 15px; border-top: 1px solid #eef1ee; padding: 13px 0; font-size: 13px; overflow-wrap: anywhere; }
.suppression-list li > span { min-width: 0; font-family: var(--mono); font-size: 12px; }
.suppression-list .text-button { flex-shrink: 0; }
.inline-empty { padding: 30px 0; color: var(--muted); font-size: 14px; }

/* Native dialogs retain keyboard focus and backdrop behavior. */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 24px; max-width: 550px; width: calc(100% - 32px); max-height: 90dvh; overflow: auto; color: var(--ink); background: var(--white); box-shadow: 0 24px 80px #10231f29; }
dialog::backdrop { background: #10231f4d; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.dialog-heading h2 { font-size: 23px; }
.close-button { font-size: 23px; line-height: 1; width: 30px; height: 30px; border: 0; border-radius: 7px; background: #f1f4f0; color: var(--muted); flex: none; }
.close-button:hover { background: #e5ebe4; color: var(--ink); }
dialog > p { font-size: 13px; margin-bottom: 22px; }
dialog form > p { margin-bottom: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.export-option { border: 1px solid var(--line); padding: 18px; border-radius: 10px; margin-top: 14px; background: #fbfcfb; }
.export-option h3 { font-size: 16px; letter-spacing: -.1px; }
#export-all-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.export-option p { font-size: 13px; color: var(--muted); margin: 7px 0 14px; }
.export-option .button-row { flex-wrap: wrap; }
.import-format { border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 0 0 14px; background: #fbfcfb; }
.import-format h3 { font-size: 16px; letter-spacing: -.1px; }
.import-format p { font-size: 13px; color: var(--muted); margin-top: 7px; overflow-wrap: anywhere; }
.import-format strong { font-weight: 600; color: var(--ink); }
#import-form { margin-top: 20px; }
.drop-zone { align-items: center; text-align: center; gap: 8px; padding: 22px 16px; border: 1px dashed #aebeb1; background: #fbfcfb; border-radius: 10px; cursor: pointer; }
.drop-zone.drag-over { border-color: var(--teal); background: #eaf2ea; outline: 2px solid #99b5a5; outline-offset: 2px; }
.drop-zone input[type=file] { max-width: 360px; background: white; margin-top: 6px; }
#import-file-name { color: var(--teal); overflow-wrap: anywhere; }
.export-note { margin: 18px 0 0; line-height: 1.55; }
.lead-editor-dialog { max-width: 720px; }
.field .optional { display: inline; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: -6px; }
.management-editor { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 22px; }
.editor-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.editor-section-heading h3 { font-size: 17px; }
.editor-section-heading .button { font-size: 12px; min-height: 34px; padding: 6px 12px; }
.management-editor > p { margin-bottom: 14px; }
.management-editor-card { border: 1px solid var(--line); padding: 16px; border-radius: 10px; background: #fbfcfb; position: relative; margin: 20px 0; }
.management-editor-card legend { font-size: 13px; padding: 0 6px; }
.management-editor-card .remove-contact { display: block; margin: 0 0 13px auto; font-size: 12px; }
.management-editor-card .field { font-size: 13px; }
.management-editor-card > p { margin: 0 0 13px; }
.management-editor-card .field:last-child { margin-bottom: 0; }
.editor-save { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.editor-save p { flex: 1; margin: 0; }
.editor-save .full { width: auto; }

/* Lead details open as a full-height evidence drawer. */
.detail-dialog { position: fixed; inset: 0 0 0 auto; margin: 0; height: 100dvh; max-height: 100dvh; width: min(650px, 100vw); max-width: 650px; border: 0; border-left: 1px solid var(--line); border-radius: 0; padding: 24px; background: #fbfcfb; box-shadow: -12px 0 60px #10231f1a; }
.detail-dialog > .dialog-heading { margin: -24px -24px 0; padding: 22px 24px 10px; background: var(--white); }
.detail-dialog .dialog-heading h2 { font-size: 23px; }
.detail-summary { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px; background: var(--white); margin: 0 -24px; padding: 0 24px 18px; }
.detail-summary > div:first-child { min-width: 0; overflow-wrap: anywhere; flex: 1 1 100%; }
.detail-summary p { color: var(--muted); font-size: 13px; margin-top: 5px; }
.detail-summary a { overflow-wrap: anywhere; }
.detail-summary > div:first-child > p > a { font-family: var(--mono); font-size: 12px; }
.detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.detail-actions .button { min-height: 36px; font-size: 13px; padding: 7px 12px; }
.detail-tabs { display: flex; gap: 22px; margin: 0 -24px; padding: 0 24px; border-bottom: 1px solid #e6eae6; background: var(--white); overflow-x: auto; scrollbar-width: thin; }
.detail-tabs [role=tab] { border: 0; background: none; padding: 10px 0; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.detail-tabs [role=tab][aria-selected=true] { font-weight: 600; color: var(--teal); border-bottom-color: var(--teal); }
.detail-tabpanel { padding-top: 22px; }
.detail-section { margin-top: 22px; }
.detail-section:first-child { margin-top: 0; }
.detail-section h3 { font-size: 15px; margin-bottom: 11px; letter-spacing: -.1px; }
.detail-section p, .detail-section li { font-size: 13px; }
.detail-section ul { padding-left: 20px; margin: 0; }
.detail-section li { margin-bottom: 7px; overflow-wrap: anywhere; }
.detail-section dl { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 10px 15px; margin: 0; font-size: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.detail-section dt { color: var(--muted); }
.detail-section dd { margin: 0; overflow-wrap: anywhere; }
.detail-section .button-row { margin-top: 12px; flex-wrap: wrap; }
.detail-note { color: var(--muted); font-size: 11.5px; margin-top: 10px; line-height: 1.55; }
.contact-line { padding: 12px 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border: 1px solid var(--line); background: var(--white); overflow-wrap: anywhere; }
.contact-line:first-of-type { border-radius: 10px 10px 0 0; }
.contact-line:last-of-type { border-radius: 0 0 10px 10px; }
.contact-line:only-of-type { border-radius: 10px; }
.contact-line + .contact-line { border-top: 0; }
.contact-line > span:first-child { font-family: var(--mono); font-size: 12px; }
.contact-line .text-button { margin-left: auto; }
.evidence-list { max-height: 360px; overflow: auto; }
.error-detail { color: var(--error); background: #fff3ee; padding: 12px; border: 1px solid #edd4c9; border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; }
.management-contact { padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; margin-top: 10px; overflow-wrap: anywhere; background: var(--white); }
.management-contact-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 5px; }
.management-contact h4 { font-size: 14.5px; line-height: 1.4; margin: 0; font-weight: 600; }
.management-contact .contact-line { padding: 10px 0 0; border: 0; }
.management-sources { display: flex; gap: 8px 16px; flex-wrap: wrap; font-size: 12px; margin-top: 10px; }
.research-notes { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 10px; color: var(--text); }

@media (min-width: 1600px) {
  main { padding-left: 36px; padding-right: 36px; }
  .app-header { padding-left: 36px; padding-right: 36px; }
}

@media (max-width: 1200px) {
  .page-heading { align-items: flex-start; gap: 16px; }
  .page-actions { flex-wrap: wrap; justify-content: flex-end; max-width: 450px; }
  .filters { flex-wrap: wrap; }
  .search-field { flex-basis: calc(100% - 180px); }
  .filter-tabs { order: 3; flex-shrink: 1; max-width: 100%; }
  #discover-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 280px; }
  .discovery-locations, .discovery-categories, .discovery-controls { padding: 16px; }
  th:nth-child(2) { width: 23%; }
  th:nth-child(3) { width: 10%; }
  th:nth-child(4) { width: 23%; }
  th:last-child { width: 18%; }
}

@media (max-width: 960px) and (min-width: 761px) {
  .page-heading { flex-direction: column; }
  .page-actions { max-width: none; }
  #discover-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .discovery-categories { border-right: 0; }
  .discovery-controls { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid #eef1ee; align-items: center; }
  .discovery-controls .maps-search { min-height: 35px; }
  .status { white-space: normal; }
  .contacts-cell > span:first-child { font-size: 11px; }
}

@media (max-width: 760px) {
  body.discovery-open { overflow: hidden; }
  .app-header { min-height: 92px; flex-wrap: wrap; gap: 0; justify-content: space-between; padding: 14px 16px 0; }
  .brand { font-size: 15px; gap: 10px; }
  .brand-icon { width: 24px; height: 24px; border-radius: 6px; }
  .app-header nav { order: 3; width: 100%; margin-top: 12px; gap: 18px; overflow-x: auto; }
  .nav-item { padding: 8px 0; border-radius: 0; border-bottom: 2px solid transparent; font-size: 14px; }
  .nav-item.active { background: none; border-bottom-color: var(--teal); }
  .nav-item:hover { background: none; }
  .local-label { font-size: 9px; padding: 3px 7px; letter-spacing: .03em; }
  .session-controls .nav-item { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font-size: 11px; }
  .count { background: #eef2ee; color: var(--teal); padding: 0 4px; }
  main { padding: 18px 16px calc(98px + env(safe-area-inset-bottom)); }
  .app-layout { min-height: calc(100dvh - 92px); }
  h1 { font-size: 26px; }
  .page-heading { display: block; margin-bottom: 16px; }
  .metrics { font-size: 12px; gap: 0 3px; line-height: 1.6; }
  .page-actions { margin-top: 12px; display: flex; justify-content: flex-start; max-width: none; gap: 8px; }
  .page-actions::before { content: ""; position: fixed; z-index: 19; left: 0; right: 0; bottom: 0; height: calc(78px + env(safe-area-inset-bottom)); background: var(--white); border-top: 1px solid #e3e7e2; box-shadow: 0 -3px 15px #10231f04; }
  .page-actions .button { min-height: 44px; font-size: 13px; padding: 8px 12px; }
  #discovery-toggle, #export-open { position: fixed; z-index: 20; bottom: calc(16px + env(safe-area-inset-bottom)); width: calc(50% - 20px); min-height: 46px; font-size: 14px; border-radius: 9px; }
  #discovery-toggle { left: 16px; }
  #export-open { right: 16px; }
  .button { min-height: 44px; }
  .filters { display: grid; grid-template-columns: minmax(0, 1fr) 118px; gap: 10px 8px; margin-bottom: 12px; }
  .search-field { min-width: 0; min-height: 44px; padding: 0 11px; }
  .search-field input { min-height: 42px; font-size: 13px; }
  .filters select { min-height: 44px; max-width: 100%; width: 100%; font-size: 12px; padding: 0 7px; }
  .filter-tabs { grid-column: 1 / -1; order: 3; gap: 7px; background: transparent; border-radius: 0; padding: 1px 1px 5px; overflow-x: auto; scrollbar-width: none; }
  .filter-tabs::-webkit-scrollbar { display: none; }
  .filter-tabs button { border: 1px solid var(--field); background: transparent; color: var(--text); min-height: 44px; padding: 8px 12px; border-radius: 22px; font-size: 13px; flex-shrink: 0; }
  .filter-tabs button.active, .filter-tabs button[aria-pressed=true], .filter-tabs button[aria-selected=true] { background: var(--teal); border-color: var(--teal); color: white; box-shadow: none; font-weight: 500; }
  .table-frame { border: 0; border-radius: 0; background: transparent; overflow: visible; }
  .bulk-toolbar { border: 1px solid var(--line); border-radius: 9px; padding: 10px; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
  .bulk-toolbar .button { font-size: 11px; padding: 5px 7px; min-height: 32px; }
  .bulk-toolbar button:disabled { display: none; }
  #selection-count, .selection-count, #result-count { font-size: 10px; }
  .bulk-toolbar #result-count { flex: 1 0 100%; text-align: right; }
  .bulk-toolbar:has(#enrich-selected:disabled) #result-count { flex: 0 1 auto; margin-left: auto; }
  table, tbody { display: block; width: 100%; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody { display: flex; flex-direction: column; gap: 10px; }
  tbody tr { display: grid; position: relative; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 0 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
  td { display: block; width: auto !important; padding: 0; border: 0; }
  .select-cell { grid-column: 1; grid-row: 1; padding: 2px 0 0; }
  .lead-cell { grid-column: 2; grid-row: 1; padding-right: 0; }
  .business-link { font-size: 15px; line-height: 1.3; }
  .lead-cell .subline { font-size: 12px; line-height: 1.45; white-space: normal; }
  .status-cell { grid-column: 3; grid-row: 1; align-self: start; padding: 0; max-width: 108px; }
  .status-cell .status { font-size: 10.5px; padding: 4px 8px; white-space: normal; }
  .contacts-cell { grid-column: 2 / -1; grid-row: 2; margin-top: 11px; }
  .contacts-cell > span:first-child, .contacts-cell > a:first-child { font-size: 11.5px; white-space: normal; overflow-wrap: anywhere; }
  .research-cell { grid-column: 2 / -1; grid-row: 3; margin-top: 7px; color: #6b7873; font-size: 12px; }
  .research-cell .subline { font-size: 11px; white-space: normal; }
  .region-cell { grid-column: 2 / -1; grid-row: 4; margin-top: 5px; color: #6b7873; font-size: 12px; }
  .region-cell::before { content: "Location · "; color: #829088; }
  .person-badge { font-size: 9px; margin-left: 0; margin-top: 4px; }
  .empty-state, .loading-state, .connection-state { min-height: 310px; padding: 35px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
  .empty-state h3, .connection-state h3 { font-size: 19px; }
  .empty-state p, .loading-state p, .connection-state p { font-size: 13px; }
  .empty-actions { gap: 7px; }
  .empty-actions .button { font-size: 12px; padding: 8px 10px; }
  .notice { margin-bottom: 14px; padding: 11px 12px; }
  .active-job { padding: 11px 13px; margin-bottom: 14px; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
  .active-job .button-row { margin-left: 0; }
  .active-job .text-button { min-height: 32px; font-size: 12px; }
  .active-job > .text-button { margin-left: auto; }
  footer { font-size: 11px; margin-top: 18px; }
  .discovery-backdrop { display: block; position: fixed; inset: 0; background: #10231f4d; z-index: 40; }
  .discovery-panel { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; margin: 0; border: 0; border-radius: 18px 18px 0 0; max-height: 90dvh; padding: 12px 16px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 -15px 60px #10231f1a; }
  .discovery-panel::before { content: ""; display: block; width: 38px; height: 4px; background: var(--line); border-radius: 20px; margin: 0 auto 14px; }
  .discovery-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
  .discovery-heading h2 { font-size: 19px; letter-spacing: -.3px; }
  .discovery-heading p { margin-top: 6px; font-size: 13px; color: var(--muted); }
  .discovery-close { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; min-height: 34px; }
  #discover-form { display: flex; flex-direction: column; gap: 18px; }
  .discovery-locations, .discovery-categories, .discovery-controls { padding: 0; border: 0; background: transparent; }
  .discovery-section-heading { flex-direction: column-reverse; align-items: stretch; gap: 14px; margin-bottom: 9px; }
  .discovery-section-heading h3 { font-size: 10.5px; }
  .discovery-panel legend { font-size: 10.5px; margin-bottom: 9px; }
  .discovery-locations .field { display: flex; flex-direction: column; align-items: stretch; font-family: inherit; font-size: 12.5px; text-transform: none; letter-spacing: 0; gap: 6px; margin-bottom: 14px; }
  .discovery-locations .field select, #location-group { max-width: none; width: 100%; min-height: 44px; padding: 8px 11px; font-size: 14px; border-radius: 9px; background: white; }
  .choice-list { gap: 7px; }
  .choice { font-size: 13px; min-height: 44px; padding: 9px 12px; }
  #locations-more { min-height: 44px; font-size: 13px; }
  .discovery-categories > p, #provider-note { margin-top: 12px; }
  .discovery-controls { gap: 14px; }
  .discovery-controls .field input, .discovery-controls .field select { min-height: 44px; font-size: 14px; padding: 8px 11px; }
  .discovery-controls .form-row { grid-template-columns: minmax(0, 1fr) 92px; }
  .enrich-choice { min-height: 44px; padding: 0; font-size: 13px; }
  .enrich-choice input { width: 18px; height: 18px; }
  .discovery-controls > .button.primary { min-height: 48px; font-size: 15px; border-radius: 10px; }
  .discovery-controls .maps-search { min-height: 36px; }
  .jobs-list { margin-top: 22px; gap: 12px; }
  .job-row { padding: 16px; }
  .job-heading { align-items: flex-start; gap: 10px; }
  .job-heading h2 { font-size: 16px; }
  .job-row p { font-size: 12.5px; }
  .job-heading .status { font-size: 10.5px; }
  .exclusions-content { margin-top: 22px; padding: 18px 16px; }
  .exclusions-content form { flex-direction: column; align-items: stretch; }
  .exclusions-content form .button { align-self: flex-start; }
  .suppression-list li { font-size: 12px; gap: 10px; }
  .suppression-list li > span { font-size: 11px; }
  dialog { padding: 20px; max-height: 92dvh; width: calc(100% - 24px); }
  .dialog-heading h2 { font-size: 21px; }
  .close-button { min-width: 34px; min-height: 34px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .field input, .field select, .field textarea { min-height: 44px; font-size: 16px; }
  .management-editor-card { padding: 13px; }
  .management-contact-heading { align-items: flex-start; }
  .editor-section-heading h3 { font-size: 16px; }
  .editor-section-heading .button { font-size: 11px; padding: 6px 8px; }
  .editor-save p { flex-basis: 100%; margin-bottom: 4px; }
  .editor-save .button { flex: 1; }
  .detail-dialog { width: 100%; max-width: none; padding: 16px; max-height: 100dvh; border: 0; }
  .detail-dialog > .dialog-heading { margin: -16px -16px 0; padding: 16px 16px 10px; }
  .detail-dialog .dialog-heading h2 { font-size: 19px; }
  .detail-summary { margin: 0 -16px; padding: 0 16px 14px; gap: 12px; }
  .detail-summary p { font-size: 12.5px; }
  .detail-summary > div:first-child > p > a { font-size: 11.5px; }
  .detail-actions { width: 100%; gap: 7px; }
  .detail-actions .button { flex: 1; min-height: 40px; font-size: 12px; padding: 7px 9px; }
  .detail-tabs { margin: 0 -16px; padding: 0 16px; gap: 18px; }
  .detail-tabs [role=tab] { font-size: 13px; min-height: 43px; }
  .detail-tabpanel { padding-top: 18px; }
  .detail-section { margin-top: 18px; }
  .detail-section h3 { font-size: 14.5px; margin-bottom: 9px; }
  .detail-section dl { grid-template-columns: 95px minmax(0, 1fr); padding: 13px; gap: 10px; font-size: 12.5px; }
  .contact-line { padding: 12px 13px; gap: 8px; }
  .contact-line > span:first-child { flex-basis: 100%; font-size: 11.5px; }
  .contact-line .status { font-size: 10.5px; }
  .contact-line .text-button { min-height: 32px; }
  .management-contact { padding: 13px; }
  .management-contact h4 { font-size: 14px; }
  .management-sources { font-size: 12px; }
  .export-option, .import-format { padding: 15px; }
}

/* Worldwide discovery and research use the same workspace controls. */
.discovery-locations #worldwide-location .field, .discovery-locations > .field { display: flex; flex-direction: column; align-items: stretch; font-family: inherit; font-size: 13px; text-transform: none; letter-spacing: 0; gap: 6px; }
.discovery-locations #worldwide-location select, .discovery-locations > .field select { width: 100%; max-width: none; min-height: 40px; background: var(--white); padding: 8px 11px; }
.city-search-row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.city-search-row .field { flex: 1; margin-bottom: 0; }
.city-search-row .button { min-height: 40px; padding: 8px 10px; font-size: 12px; }
.city-attribution { margin-top: 4px; }
.custom-location-choice { margin: 12px 0; }
.radius-field { margin-top: 14px; max-width: 170px; }
#custom-location .form-row { gap: 8px; }
#worldwide-industry p { margin-top: 8px; }
.research-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin: -2px 0 14px; }
.research-filters label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.research-filters select { border: 1px solid var(--field); border-radius: 7px; background: var(--white); color: var(--ink); min-height: 36px; padding: 6px 10px; }
.research-badge { display: inline-block; font-size: 10px; color: var(--teal); background: #e8f0eb; border-radius: 4px; padding: 2px 5px; margin-top: 5px; }
.research-editor { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 24px; }
.research-editor > h3, .research-editor > fieldset { margin-bottom: 16px; }
.research-editor > .small { margin-bottom: 14px; }
.opportunity-editor-card, .opportunity-card { border: 1px solid var(--line); border-radius: 9px; padding: 16px; margin-top: 14px; }
.opportunity-editor-card > .text-button { display: block; margin-left: auto; margin-bottom: 12px; }
.opportunity-editor-card .field:last-child { margin-bottom: 0; }
.opportunity-card > p, .opportunity-card > a { display: block; margin-top: 8px; }
.research-search-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; font-size: 13px; }
.export-scope { margin: 18px 0; }
.export-scope p { margin-top: 9px; line-height: 1.5; }
.ai-research-card { border: 1px solid #cbdcd2; border-radius: 10px; background: #f4f8f4; padding: 16px; margin-bottom: 22px; }
.ai-card-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 10px; }
.ai-card-heading h3 { font-size: 16px; }
.ai-research-card > p { margin: 8px 0; }
.ai-research-card .button-row { flex-wrap: wrap; margin-top: 12px; }
.ai-draft { border-top: 1px solid #dce6dd; margin-top: 16px; padding-top: 16px; }
.ai-draft h4 { margin: 14px 0 6px; }
.ai-draft > p, .ai-source p { white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-source { border-left: 2px solid #b8cfc0; padding-left: 12px; margin-top: 12px; }
.ai-source blockquote { margin: 8px 0; font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-opportunity-quote { border-left: 2px solid #b8cfc0; padding-left: 12px; margin: 12px 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-stale { border-left: 2px solid #b79247; padding-left: 10px; color: #745d2e; }
.ai-all-sources { margin-top: 16px; }
.ai-profile-note, .ai-apply-note { margin: 14px 0; }
.ai-profile-dialog, .ai-review-dialog { width: min(620px, calc(100% - 32px)); }
#ai-profile-status { margin: 12px 0; }
#ai-profile-fields { margin-top: 18px; }
.ai-review-choice { display: flex; align-items: flex-start; gap: 10px; margin: 18px 0 8px; font-weight: 600; }
.ai-review-choice input { margin-top: 3px; }
.ai-review-copy { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 14px 26px; font-size: 13px; }
.detail-tabs { overflow-x: auto; }
.detail-tabs [role=tab] { white-space: nowrap; }
@media (max-width: 760px) {
  .research-filters { gap: 10px; }
  .research-filters label { flex: 1; display: block; min-width: 120px; }
  .research-filters select { display: block; width: 100%; margin-top: 4px; min-height: 44px; }
  .research-filters > span { flex-basis: 100%; }
  .city-search-row .button, .discovery-locations #worldwide-location select, .discovery-locations > .field select { min-height: 44px; }
  .opportunity-editor-card, .opportunity-card { padding: 12px; }
  .export-scope .choice { white-space: normal; }
  .ai-research-card { padding: 14px; }
  .ai-research-card .button-row .button { min-height: 44px; flex: 1; }
  .ai-review-dialog .editor-save, .ai-profile-dialog .editor-save { display: flex; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
