/* Interaction uses one accent; other colours describe data states. */
:root {
  --surface: #ffffff;
  --page: #f4f6f9;
  --surface-muted: #f7f9fb;
  --line: #e3e8ef;
  --line-strong: #cbd4e1;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2b59d9;
  --positive: #15803d;
  --warning: #b45309;
  --danger: #b42318;
  --danger-surface: #fef3f2;
  --empty: #9aa0a6;
  --empty-text: #62676c;
  --radius-control: 8px;
  --radius-card: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-raised: 0 4px 12px rgba(15, 23, 42, .08), 0 1px 3px rgba(15, 23, 42, .06);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  font: 14px/1.55 var(--font-body);
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
.explorer h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.02em;
  margin-bottom: 6px;
}
.explorer label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.explorer .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.explorer textarea {
  line-height: 1.6;
}
.explorer tr:last-child td {
  border-bottom: 0;
}
.explorer {
  overflow-wrap: anywhere;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  width: 100%;
  min-width: 0;
}
.explorer #sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  width: 220px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: var(--space-6) var(--space-4);
  gap: var(--space-6);
}
.explorer #sidebar header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
}
.explorer #navigation {
  display: flex;
  padding: 0;
  gap: 6px;
  flex-direction: column;
}
.explorer #navigation a {
  display: block;
  padding: 9px var(--space-3);
  border-radius: var(--radius-control);
  color: var(--text);
  text-decoration: none;
}
.explorer #navigation a[aria-current] {
  background: var(--page);
  font-weight: 600;
  box-shadow: inset 3px 0 var(--accent);
}
.explorer #identity {
  font-size: 12px;
  color: var(--muted);
  margin-top: auto;
  overflow-wrap: anywhere;
}
.explorer #menu-toggle {
  display: none;
}
.explorer main {
  max-width: none;
  padding: var(--space-8) clamp(var(--space-4), 3vw, 48px) 80px;
}
.explorer h2 {
  font-size: 18px;
  margin: var(--space-3) 0;
}
.explorer h3 {
  font-size: 15px;
  margin: 14px 0 var(--space-2);
}
.explorer p {
  margin: var(--space-2) 0;
}
.explorer a {
  color: var(--text);
  text-underline-offset: 3px;
}
.explorer small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: normal;
}
.explorer button,
.explorer input,
.explorer select,
.explorer textarea {
  font: inherit;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  padding: var(--space-2) 11px;
  background: var(--surface);
  max-width: 100%;
}
.explorer button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 500;
  box-shadow: var(--shadow);
  cursor: pointer;
  min-height: 38px;
}
.explorer button:hover:not(:disabled) {
  background: var(--page);
  border-color: var(--muted);
}
.explorer button:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.explorer input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.explorer input:focus,
.explorer select:focus,
.explorer textarea:focus {
  border-color: var(--accent);
  box-shadow: none;
}
.explorer :focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.explorer .panel,
.explorer .empty {
  padding: var(--space-5);
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}
.explorer .empty {
  padding: 36px;
}
.explorer .page-heading,
.explorer .toolbar,
.explorer .list-footer,
.explorer .run-card header {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  justify-content: space-between;
}
.explorer .toolbar {
  justify-content: flex-start;
  margin: var(--space-4) 0;
}
.explorer .list-footer {
  padding: 18px 0;
}
.explorer .action {
  display: inline-flex;
  flex-direction: column;
  gap: var(--space-1);
  max-width: 400px;
}
.explorer .form-grid,
.explorer .intake-methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}
.explorer .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: var(--space-3) 0;
  min-width: 0;
  font-weight: 500;
}
.explorer .field textarea {
  resize: vertical;
  min-height: 90px;
}
.explorer .check {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-4) 0;
}
.explorer fieldset {
  border: 1px solid var(--line);
  padding: var(--space-4);
  border-radius: var(--radius-control);
  margin: var(--space-5) 0;
  min-width: 0;
}
.explorer legend {
  padding: 0 6px;
  font-weight: 600;
}
.explorer [data-errors]:not(.request-status):not(:empty),
.explorer .field-error:not(:empty) {
  padding: var(--space-2);
  border-left: 3px solid var(--danger);
  background: var(--danger-surface);
  color: var(--danger);
  margin: var(--space-2) 0;
}
.explorer .filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-4) 0;
}
.explorer .filters > .field {
  flex: 1 1 200px;
  min-width: 0;
}
.explorer .filters details[open] {
  flex-basis: 100%;
  order: 3;
}
.explorer details {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
}
.explorer summary {
  cursor: pointer;
}
.explorer .grid-scroll {
  position: relative;
  overflow-x: auto;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
}
.explorer table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  table-layout: auto;
}
.explorer th,
.explorer td {
  padding: var(--space-3) 14px;
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.explorer th {
  background: var(--surface-muted);
  font-weight: 600;
  white-space: nowrap;
  font-size: 12px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
}
.explorer th button {
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  border: 0;
  background: transparent;
  padding: 0;
  min-height: 28px;
}
.explorer th[aria-sort="ascending"] button::after {
  content: ' ↑';
}
.explorer th[aria-sort="descending"] button::after {
  content: ' ↓';
}
.explorer tr[data-company] {
  cursor: pointer;
}
.explorer tr[data-company]:hover,
.explorer tr[data-company]:focus-within {
  background: var(--surface-muted);
}
.explorer .text-button {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: start;
  font-weight: 600;
  min-height: 24px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.explorer .coverage-dots {
  display: flex;
  gap: var(--space-1);
}
.explorer .dot {
  font-size: 13px;
  min-width: 14px;
  text-align: center;
}
.explorer .dot.state-empty {
  color: var(--empty);
}
.explorer .badge {
  display: inline-block;
  border: 1px solid currentColor;
  border-radius: 99px;
  padding: 1px 6px;
}
.explorer .state-open {
  color: var(--warning);
}
.explorer .state-done {
  color: var(--positive);
}
.explorer .state-empty {
  color: var(--empty-text);
}
.explorer .state-failed {
  color: var(--danger);
}
.explorer .segments {
  min-width: 160px;
  max-width: 320px;
  margin: var(--space-2) 0;
}
.explorer .segment-track {
  display: flex;
  gap: 2px;
  height: 6px;
  overflow: hidden;
}
.explorer .segment {
  --count: 1;
  flex: var(--count) 1 0;
  min-width: 2px;
  background: currentColor;
}
.explorer .segment-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
}
.explorer .matrix {
  min-width: 540px;
}
.explorer .matrix-cell {
  display: block;
  min-width: 220px;
  margin: var(--space-1) 0 14px;
  text-decoration: none;
}
.explorer .matrix-cell > span {
  display: block;
}
.explorer .tabs {
  padding: 0;
  display: flex;
  flex-direction: row;
  gap: var(--space-2);
  overflow-x: auto;
  border-bottom: 1px solid var(--line-strong);
  margin: var(--space-5) 0 var(--space-6);
}
.explorer .tabs a {
  white-space: nowrap;
  text-decoration: none;
  padding: var(--space-3);
  border-bottom: 3px solid transparent;
}
.explorer .tabs a[aria-current] {
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.explorer .metrics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
}
.explorer .metrics strong {
  display: block;
  font-size: 24px;
}
.explorer dialog {
  position: fixed;
  margin: auto;
  inset: 0;
  width: min(580px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  color: var(--text);
  background: var(--surface);
  overflow-y: auto;
}
.explorer dialog::backdrop {
  background: rgba(15, 23, 42, .3);
}
.explorer dialog > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}
.explorer dialog > header h2 {
  margin-top: 0;
  overflow-wrap: anywhere;
}
.explorer dialog.drawer {
  margin: 0 0 0 auto;
  height: 100dvh;
  max-height: 100dvh;
  width: min(680px, 90vw);
  border-radius: 0;
}
.explorer dialog.wide-dialog {
  width: min(900px, calc(100vw - 32px));
}
.explorer .drawer section {
  border-bottom: 1px solid var(--line);
  padding: var(--space-3) 0;
}
.explorer .observation,
.explorer .intake-row,
.explorer .run-card,
.explorer [data-email] {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--line);
}
.explorer pre {
  font: 12px/1.55 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.explorer progress {
  width: 100%;
  height: 10px;
  accent-color: var(--positive);
  margin-top: var(--space-3);
}
.explorer #toasts {
  position: fixed;
  bottom: 16px;
  right: 16px;
  max-width: min(400px, calc(100vw - 32px));
  z-index: 10;
}
.explorer #toasts p {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  box-shadow: var(--shadow-raised);
}
.explorer .muted {
  color: var(--muted);
}
.explorer .sr-only,
.explorer .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.explorer .skip-link:focus {
  position: fixed;
  z-index: 20;
  background: var(--surface);
  padding: var(--space-3);
}
.explorer [hidden] {
  display: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .explorer *,
.explorer *::before,
.explorer *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
}

/* All children may shrink;
  only .grid-scroll owns a wide table's intrinsic width. */
.explorer *,
.explorer *::before,
.explorer *::after {
  box-sizing: border-box;
}
.explorer main {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.explorer #screen,
.explorer .campaign-heading,
.explorer section,
.explorer article,
.explorer form,
.explorer fieldset,
.explorer .form-grid > *,
.explorer .intake-methods > *,
.explorer .toolbar > *,
.explorer details,
.explorer .action,
.explorer .tabs,
.explorer .page-heading > * {
  min-width: 0;
  max-width: 100%;
}
.explorer h1,
.explorer h2,
.explorer h3,
.explorer h4,
.explorer p,
.explorer a,
.explorer label,
.explorer small,
.explorer button,
.explorer legend {
  overflow-wrap: anywhere;
}
.explorer .field input,
.explorer .field select,
.explorer .field textarea {
  width: 100%;
  min-width: 0;
}
.explorer .grid-scroll {
  min-width: 0;
  max-width: 100%;
  contain: inline-size;
  overscroll-behavior-inline: contain;
  box-shadow: inset 7px 0 8px -7px var(--muted), inset -7px 0 8px -7px var(--muted);
}
.explorer .grid-scroll table {
  min-width: 640px;
}
.explorer .grid-scroll .company-grid {
  width: max-content;
  min-width: 100%;
}
.explorer .grid-scroll td,
.explorer .grid-scroll th {
  max-width: 400px;
  overflow-wrap: anywhere;
}
.explorer .tabs {
  flex-wrap: wrap;
  overflow: visible;
}
.explorer .checklist {
  margin: var(--space-3) 0;
  padding: var(--space-3);
}
.explorer .checklist-options {
  max-height: 300px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: var(--space-1);
}
.explorer .checklist-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: var(--space-2) 2px;
  color: var(--text);
}
.explorer .checklist-option input {
  flex: 0 0 18px;
  margin-top: 2px;
}
.explorer .checklist-option span {
  min-width: 0;
}
.explorer .checklist h4 {
  margin: var(--space-3) 0 6px;
}
.explorer .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.explorer .chip {
  font-size: 12px;
  padding: var(--space-1) var(--space-2);
  min-height: 32px;
  text-align: start;
}
.explorer .data-record {
  border-bottom: 1px solid var(--line);
  padding: var(--space-3) 0;
}
.explorer .plain-list {
  padding-inline-start: 22px;
}
.explorer .loading-state,
.explorer .empty-state {
  min-height: 160px;
  display: grid;
  align-content: center;
  padding: var(--space-5);
}
.explorer [data-plan],
.explorer [data-runs],
.explorer [data-users],
.explorer [data-coverage],
.explorer [data-review-list],
.explorer [data-delivery-list] {
  min-height: 180px;
}
.explorer .review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: var(--space-6);
}
.explorer .review-layout > * {
  min-width: 0;
}
.explorer .review-facts {
  position: sticky;
  top: 0;
  align-self: start;
}
.explorer .step-finding {
  border-inline-start: 3px solid var(--warning);
  padding: var(--space-2);
  margin: var(--space-2) 0;
}
.explorer .step-finding.critical {
  border-color: var(--danger);
}
.explorer .outreach-list {
  height: clamp(240px, 45vh, 520px);
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.explorer .outreach-list > article {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--line);
}
.explorer .message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.explorer dialog {
  min-width: 0;
}
.explorer #main[aria-busy="true"] {
  min-height: 75vh;
}
@media (max-width: 1000px) {
  .explorer {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}
  .explorer #sidebar {
  width: 100%;
  height: auto;
  position: static;
  padding: var(--space-4);
  gap: 0;
  border-right: 0;
  border-bottom: 1px solid var(--line);
}
  .explorer #menu-toggle {
  display: block;
}
  .explorer #sidebar:not(.expanded) #navigation,
.explorer #sidebar:not(.expanded) #identity {
  display: none;
}
  .explorer .form-grid,
.explorer .intake-methods,
.explorer .review-layout {
  grid-template-columns: minmax(0, 1fr);
}
  .explorer .review-facts {
  position: static;
}
  .explorer main {
  padding: var(--space-5) var(--space-4) 70px;
}
  .explorer .panel {
  padding: var(--space-4);
}
}
@media (max-width: 900px) {
  .explorer h1 {
    font-size: 22px;
  }
}
@media (max-width: 600px) {
  .explorer dialog.drawer {
  width: 100%;
  padding: var(--space-4);
}
  .explorer dialog.wide-dialog {
  width: calc(100% - 16px);
  padding: var(--space-4);
}
}

.explorer .grid-scroll:has(.company-grid) {
  height: clamp(320px, 65vh, 680px);
  scrollbar-gutter: stable;
}
.explorer .grid-scroll table {
  background: transparent;
}
.explorer .checklist legend {
  max-width: 100%;
}
.explorer .toolbar .field {
  flex: 1 1 180px;
}
.explorer .metrics > p {
  min-width: 0;
}

/* Absolute accessibility labels must remain inside their scrolling container. */
.explorer .dot {
  position: relative;
}
.explorer .filters > *,
.explorer .toolbar > *,
.explorer .list-footer > *,
.explorer .metrics > *,
.explorer .run-card header > *,
.explorer dialog > header > * {
  min-width: 0;
  max-width: 100%;
}
.explorer .company-grid td,
.explorer .company-grid th {
  white-space: nowrap;
  overflow-wrap: normal;
}
/* Keep company names readable while the table scrolls in its container. */
.explorer .company-grid .company-cell {
  width: 260px;
  min-width: 220px;
  max-width: none;
}
.explorer .company-identity {
  width: 232px;
}
.explorer .truncate {
  display: block;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow-wrap: normal;
  word-break: normal;
}
.explorer .error-state {
  padding: var(--space-4);
  border-inline-start: 3px solid var(--danger);
  background: var(--danger-surface);
}
.explorer .error-state button {
  margin-top: var(--space-2);
}
.explorer .request-status {
  min-height: 64px;
}
.explorer .request-status .loading-state,
.explorer .request-status .error-state {
  min-height: 64px;
}

.explorer .companies-status:empty {
  display: none;
}
