/* SmartData guided wizard (test worker). Mirrors the SmartMail Beta step pattern
   inside the existing portal chrome: numbered steps, one decision per step, pinned Back/Next. */
html:has(.page-smartdata-wizard),
body:has(.page-smartdata-wizard) {
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
  overscroll-behavior: none;
}
body:has(.page-smartdata-wizard) .shell {
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  overflow: hidden;
}
body:has(.page-smartdata-wizard) .main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
  padding-bottom: 0;
}
.page-smartdata-wizard {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  max-width: 1120px;
  overflow: hidden;
}
/* #sd-wizard sits between .page and the scroll/nav pair, so it must be the
   flex column that actually consumes remaining height. Without this the scroll
   pane grows with the form, the footer sits off-screen, and nothing scrolls. */
.page-smartdata-wizard #sd-wizard {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.page-smartdata-wizard .sd-wizard-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-bottom: 12px;
}
.page-smartdata-wizard.page { padding-bottom: 16px; }
.page-smartdata-wizard .page-head { margin-bottom: 8px; }
.sd-wizard[data-step]:not([data-step="1"]) .sd-presets { display: none !important; }
.sd-stepsbar {
  display: flex;
  gap: 0;
  margin: 4px 0 18px;
  align-items: center;
  flex-wrap: wrap;
}
.sd-stepsbar .s {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 500 13px var(--sans);
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}
.sd-stepsbar .s .n {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  font-size: 12px;
  flex: none;
}
.sd-stepsbar .s.on { color: var(--ink); }
.sd-stepsbar .s.on .n {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}
.sd-stepsbar .s.done .n {
  background: #efeaff;
  border-color: #c9b8f8;
  color: #3b3794;
}
.sd-stepsbar .s[disabled] { cursor: default; opacity: 0.7; }
.sd-stepsbar .line {
  width: 22px;
  height: 1px;
  background: var(--line);
  margin: 0 8px;
}
.sd-step-lede { color: var(--muted); max-width: 68ch; margin: 0 0 16px; font-size: 16px; }
.sd-step.is-hidden { display: none; }
.sd-wizard-nav {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: 12px 0 8px;
  margin: 0 -4px;
  z-index: 5;
}
.sd-wizard-nav .sd-wizard-msg { flex: 1; color: #9a3b2f; font-size: 13.5px; min-height: 1.2em; }
.sd-wizard-nav .button { min-width: 108px; }
.sd-wizard-nav .button[disabled] { opacity: 0.45; cursor: default; }
.sd-preview-dl { display: grid; grid-template-columns: 160px 1fr; gap: 8px 18px; margin: 0 0 18px; }
.sd-preview-dl dt { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.sd-preview-dl dd { margin: 0; }
.sd-est {
  background: #efeaff;
  border: 1px solid #d8cff8;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0 0;
}
.sd-est strong { font-family: var(--serif); font-size: 22px; font-weight: 520; display: block; margin-bottom: 4px; }
.sd-est p { margin: 0; color: var(--muted); font-size: 13.5px; }
.sd-form.sd-wizard-form { background: transparent; border: 0; padding: 0; box-shadow: none; }
.sd-form.sd-wizard-form .sd-sec,
.sd-form.sd-wizard-form .sd-contacts,
.sd-form.sd-wizard-form .sd-saved,
.sd-wizard .card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 22px 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.sd-form.sd-wizard-form .sd-foot { display: none; }
.sd-wizard[data-step]:not([data-step="1"]) .sd-saved,
.sd-wizard[data-step]:not([data-step="1"]) .sd-admin,
.sd-wizard[data-step]:not([data-step="1"]) .sd-recent { display: none !important; }
.sd-step5 #sd-bar { flex-wrap: wrap; background: transparent; box-shadow: none; border: 0; padding: 0; }
.sd-step5 #sd-bar .bar-right { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.sd-step5 #sd-listname { min-width: 280px; }
.sd-score-cell { min-width: 0; width: 7.5rem; vertical-align: top; }
.sd-score-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font: 600 13px var(--sans);
  border-radius: 999px;
  padding: 2px 9px;
  letter-spacing: 0.02em;
}
.sd-score-badge.grade-A { background: #e8f7ee; color: #146c36; }
.sd-score-badge.grade-B { background: #eef2ff; color: #3730a3; }
.sd-score-badge.grade-C { background: #f4f1ea; color: #6d675f; }
.sd-score-why { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; max-width: 100%; line-height: 1.35; }
th.sd-score-th { cursor: pointer; white-space: nowrap; }
th.sd-score-th:hover { color: var(--purple); }
.sd-score-filter { display: flex; gap: 10px; align-items: center; margin: 0 0 10px; flex-wrap: wrap; }
.sd-score-filter label { flex-direction: row; align-items: center; gap: 8px; letter-spacing: 0; text-transform: none; font-size: 13.5px; color: var(--ink); min-width: 0; }
.sd-score-filter select { min-width: 140px; }
.sd-step5 .hint { margin-top: 8px; }
.page-smartdata-wizard .sd-admin,
.page-smartdata-wizard .sd-recent { margin-top: 22px; }
@media (max-width: 800px) {
  .sd-preview-dl { grid-template-columns: 1fr; }
  .sd-stepsbar .s span.label { display: none; }
}

/* Radios on SmartData must not inherit the full-width 48px text-input styling —
   that stretched native radios into huge stacked circles with labels pushed aside. */
.sd-page input[type="radio"] {
  -webkit-appearance: auto;
  appearance: auto;
  width: 16px !important;
  min-width: 16px;
  height: 16px !important;
  min-height: 16px !important;
  margin: 0;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: none !important;
  box-shadow: none !important;
  accent-color: var(--purple);
  flex: none;
}
.sd-page input[type="radio"]:hover,
.sd-page input[type="radio"]:focus {
  background: none !important;
  box-shadow: none !important;
  border: 0 !important;
}

/* Compact segmented control for Email / Mobile / Both */
.sd-lookup-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 14px 0 8px;
  box-shadow: var(--shadow);
}
.sd-lookup-copy { flex: 1 1 240px; min-width: 0; }
.sd-lookup-copy strong { display: block; font: 600 14px var(--sans); margin-bottom: 2px; }
.sd-lookup-copy .meta { margin: 0; font-size: 12.5px; color: var(--muted); }
.sd-lookup-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sd-seg {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.sd-seg-opt {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0 !important;
  margin: 0;
  padding: 0;
  min-width: 0 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  font: 500 13.5px var(--sans) !important;
  color: var(--ink) !important;
  cursor: pointer;
}
.sd-seg-opt input {
  position: absolute;
  opacity: 0;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  pointer-events: none;
}
.sd-seg-opt span {
  display: block;
  padding: 8px 16px;
  border-right: 1px solid var(--line);
  background: #fff;
  line-height: 1.2;
}
.sd-seg-opt:last-child span { border-right: 0; }
.sd-seg-opt:hover span { background: #f4f0ff; }
.sd-seg-opt:has(input:checked) span {
  background: #efeaff;
  color: #3b3794;
  font-weight: 600;
}
.sd-seg-opt:has(input:focus-visible) span { box-shadow: inset 0 0 0 2px var(--purple); }
.sd-lookup-form .button { min-width: 0; padding: 8px 14px; }

/* The review-page action bar is sticky in the old SmartData CSS. Once the
   wizard scroll pane is height-constrained, that bar covers the score table.
   Keep it in normal flow on step 4, under the table and above contact lookup. */
#sd-wizard[data-step="4"] .sd-bar {
  position: static;
  bottom: auto;
}

#sd-wizard-nav [hidden] { display: none !important; }

/* Review table: fit Email/Phone under the name so the table stays within the
   1054px (1440) / 1242px (1920) pane without hiding columns. */
.page-smartdata-wizard .table-card .table-wrap {
  overflow-x: auto;
  max-width: 100%;
}
.page-smartdata-wizard table.sd-table {
  width: 100%;
  table-layout: fixed;
}
.page-smartdata-wizard .sd-table th,
.page-smartdata-wizard .sd-table td {
  padding-left: 8px;
  padding-right: 8px;
  vertical-align: top;
}
.page-smartdata-wizard .sd-table .who-name { white-space: normal; }
.page-smartdata-wizard .sd-table td:nth-child(3),
.page-smartdata-wizard .sd-table td:nth-child(4),
.page-smartdata-wizard .sd-table td:nth-child(5) { min-width: 0; }
.page-smartdata-wizard .sd-table th.pick,
.page-smartdata-wizard .sd-table td.pick { width: 2.4rem; }
.page-smartdata-wizard .sd-table th.sd-score-th { width: 7.5rem; }
.page-smartdata-wizard .sd-table th.num,
.page-smartdata-wizard .sd-table td.num { width: 4.5rem; }
.page-smartdata-wizard .sd-who-cell .name { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.page-smartdata-wizard .sd-contact { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.page-smartdata-wizard .sd-contact-line {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.page-smartdata-wizard .sd-contact-k {
  font-weight: 600;
  color: var(--ink);
  margin-right: 4px;
  letter-spacing: 0.02em;
  text-transform: none;
}
.page-smartdata-wizard .sd-contact-line .sig-line { display: inline; margin-left: 4px; }
.page-smartdata-wizard .sd-table td,
.page-smartdata-wizard .sd-table th { overflow-wrap: anywhere; }
.sd-table-scroll-cue {
  margin: 0 24px 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.page-smartdata-wizard .table-wrap.is-overflowing {
  box-shadow: inset -16px 0 16px -16px rgba(28, 20, 70, 0.18);
}

/* Live-search confirm */
.sd-confirm {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(20, 14, 50, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.sd-confirm[hidden] { display: none !important; }
.sd-confirm-card {
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 30px 70px -24px rgba(44, 32, 110, 0.45);
  padding: 24px 26px 22px;
  max-width: 440px;
  width: 100%;
}
.sd-confirm-card h2 { margin: 0 0 8px; font-size: 22px; }
.sd-confirm-card p { margin: 0 0 10px; }
.sd-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
