/* Keep setup in the same quiet conversation family as the personal agent. */
body.setup-page {
  --linial-bg: #141514;
  --linial-surface: #202220;
  --linial-surface-raised: #292b28;
  --linial-rule: #373b36;
  --linial-text: #edeee9;
  --linial-muted: #aeb3aa;
  --linial-gold: #d8bd78;
  --setup-accent: #d8bd78;
  --setup-accent-strong: #d8bd78;
  --setup-selected: #363125;
  --setup-content-width: 680px;
  color-scheme: dark;
  color: var(--linial-text);
  background: var(--linial-bg);
}
body.setup-page .setup-shell { width: 100%; max-width: none; }
body.setup-page .setup-conversation { width: 100%; background: transparent; }
body.setup-page .setup-head {
  box-sizing: border-box;
  width: 100%;
  max-width: 728px;
  height: 68px;
  flex-basis: 68px;
  gap: 9px;
  margin: 0 auto;
  padding: 0 24px;
  border-bottom: 1px solid var(--linial-rule);
  background: transparent;
}
body.setup-page .setup-head::after { display: none; }
body.setup-page .setup-head .sunflower { width: 52px; height: 52px; flex: 0 0 52px; margin: 0; color: var(--linial-gold); }
body.setup-page .setup-thread { box-sizing: border-box; width: min(100%, 728px); padding: 44px 24px 32px; }
body.setup-page .setup-current { gap: 18px; padding-top: 0; }
body.setup-page .setup-current > .setup-message,
body.setup-page .setup-step,
body.setup-page .setup-source-actions,
body.setup-page .setup-source-secondary { max-width: var(--setup-content-width); }
body.setup-page .setup-message { color: var(--linial-text); font-size: 15px; line-height: 1.6; }
body.setup-page .setup-message > p,
body.setup-page .setup-introduction > p:first-child,
body.setup-page .setup-introduction > p.setup-question {
  color: #c8ccc5;
  font-size: 15.5px;
  font-weight: 400;
  line-height: 1.6;
}
body.setup-page .setup-introduction > p.setup-question { margin-top: 22px; color: var(--linial-text); }
body.setup-page .setup-message > .setup-question,
body.setup-page .setup-message > .setup-title,
body.setup-page .setup-step > .setup-step-title,
body.setup-page .setup-knowledge-topics > .setup-title { color: var(--linial-text); font-size: 16px; font-weight: 500; line-height: 1.45; }
body.setup-page .setup-message small,
body.setup-page .setup-step > .setup-step-detail,
body.setup-page .setup-knowledge-topics > small,
body.setup-page .setup-source-empty,
body.setup-page .setup-review-citations,
body.setup-page .setup-review-original { color: var(--linial-muted); }
body.setup-page .setup-history { gap: 26px; padding-bottom: 28px; }
body.setup-page .setup-turn-question { max-width: 100%; padding: 0; border: 0; background: transparent; color: var(--linial-muted); font-size: 15px; font-weight: 500; }
body.setup-page .setup-turn-answer > p {
  max-width: min(100%, 540px);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #c8ccc5;
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
}
body.setup-page .setup-turn-answer .setup-edit-message { color: var(--setup-accent) !important; }
body.setup-page .setup-prepared-identity,
body.setup-page .setup-candidates button {
  padding: 15px 18px;
  border: 1px solid var(--linial-rule);
  border-radius: 16px;
  background: var(--linial-surface);
  color: var(--linial-text);
  box-shadow: none;
}
body.setup-page .setup-prepared-identity > span,
body.setup-page .setup-candidates button > span { color: var(--linial-text); }
body.setup-page .setup-prepared-identity small,
body.setup-page .setup-candidates button > small { color: var(--linial-muted); }
body.setup-page .setup-candidates button:hover { border-color: var(--setup-accent); background: var(--linial-surface-raised); }
body.setup-page .setup-candidate-option { display: grid; justify-items: start; gap: 2px; }
body.setup-page .setup-google-maps-attribution { margin: 0 0 6px 18px; color: #5e5e5e; font-family: Roboto, Arial, sans-serif; font-size: 12px; font-style: normal; font-weight: 400; letter-spacing: normal; line-height: 1.4; text-decoration: none; white-space: nowrap; }
body.setup-page .setup-google-maps-attribution:hover { text-decoration: underline; }
body.setup-page .setup-google-maps-attribution:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
body.setup-page .setup-identity-search-note { display: block; margin-top: 8px; }
body.setup-page :is(.setup-form, .setup-review-value, .setup-knowledge-custom) :is(input, select, textarea),
body.setup-page .setup-source-review .setup-facts :is(input, textarea) {
  border-color: var(--linial-rule);
  border-radius: 10px;
  background: var(--linial-surface);
  color: var(--linial-text);
}
body.setup-page .setup-form label,
body.setup-page .setup-source-review .setup-facts label { color: var(--linial-muted); }
body.setup-page .setup-facts > div { border-color: var(--linial-rule); }
body.setup-page .setup-facts span { color: var(--linial-text); }
body.setup-page .setup-source-review.setup-agent {
  background: var(--linial-surface) !important;
  border-color: var(--linial-rule) !important;
}
body.setup-page .setup-source-review .setup-source-intro {
  color: var(--linial-muted);
  font-size: 14px;
  line-height: 1.6;
}
body.setup-page .setup-source-review .setup-review-add {
  min-height: 40px;
  padding: 8px 12px !important;
  border: 1px solid var(--linial-rule) !important;
  border-radius: 10px;
  background: var(--linial-surface) !important;
  color: var(--setup-accent);
}
body.setup-page :is(.setup-sources, .setup-phone-test, .setup-other-connections) { border-color: var(--linial-rule); }
body.setup-page :is(.setup-sources, .setup-sources summary, .setup-other-connections > summary,
  .setup-knowledge-more > summary, .setup-manual-context > summary) { color: var(--linial-muted); }
body.setup-page .setup-sources a { color: var(--setup-accent); }
body.setup-page :is(.setup-focus-options, .setup-handoff-options, .setup-knowledge-options, .setup-connection-options) button {
  border-color: var(--linial-rule);
  background: var(--linial-surface);
  color: var(--linial-text);
}
body.setup-page :is(.setup-focus-options, .setup-handoff-options, .setup-knowledge-options, .setup-connection-options) button:hover { border-color: var(--setup-accent); background: var(--linial-surface-raised); }
body.setup-page :is(.setup-focus-options, .setup-handoff-options, .setup-knowledge-options, .setup-connection-options) button[aria-pressed="true"] { border-color: var(--setup-accent); background: var(--setup-selected); }
body.setup-page .setup-handoff-options label {
  border-color: var(--linial-rule);
  border-radius: 10px;
  background: var(--linial-surface);
  color: var(--linial-text);
}
body.setup-page .setup-handoff-options label:hover,
body.setup-page .setup-handoff-options label:focus-within { border-color: var(--setup-accent); background: var(--linial-surface-raised); }
body.setup-page .setup-handoff-options label:has(input:checked) { border-color: var(--setup-accent); background: var(--setup-selected); }
body.setup-page .setup-handoff-options label:focus-within,
body.setup-page .setup-focus-options button:focus-visible { outline-color: var(--setup-accent); }
body.setup-page .setup-knowledge-custom input:focus { border-color: var(--setup-accent); outline-color: var(--setup-accent); }
body.setup-page .setup-handoff-options input,
body.setup-page .setup-transfer-triggers input { accent-color: var(--setup-accent); }
body.setup-page .setup-transfer-triggers > p { color: var(--linial-text); }
body.setup-page .setup-transfer-triggers label { color: var(--linial-muted); }
body.setup-page .setup-transfer-triggers small { color: var(--linial-muted); }
body.setup-page .setup-handoff-actions .setup-handoff-other {
  min-height: 38px;
  padding: 8px 12px !important;
  border: 1px solid var(--linial-rule) !important;
  border-radius: 10px;
  background: var(--linial-surface) !important;
  color: var(--setup-accent) !important;
}
body.setup-page .setup-actions .primary,
body.setup-page :is(.setup-step-actions, .setup-form-actions, .setup-knowledge-actions, .setup-source-actions, .setup-question-actions, .setup-handoff-actions) .primary {
  border-color: var(--setup-accent-strong);
  border-radius: 10px;
  background: var(--setup-accent-strong);
  color: #1b1a15;
}
body.setup-page .setup-actions .primary:hover,
body.setup-page :is(.setup-step-actions, .setup-form-actions, .setup-knowledge-actions, .setup-source-actions, .setup-question-actions, .setup-handoff-actions) .primary:hover { border-color: #e7d096; background: #e7d096; color: #1b1a15; }
body.setup-page :is(.quiet-link, .setup-back) { color: var(--linial-muted) !important; }
body.setup-page .setup-back:hover { color: var(--linial-text) !important; }
body.setup-page :is(.setup-source-secondary, .setup-actions, .setup-step-actions,
  .setup-form-actions, .setup-knowledge-actions) > .quiet-link:not(.setup-back) {
  border-color: var(--linial-rule) !important;
  border-radius: 10px;
  color: var(--linial-muted) !important;
}
body.setup-page :is(.setup-source-secondary, .setup-actions, .setup-step-actions,
  .setup-form-actions, .setup-knowledge-actions) > .quiet-link:not(.setup-back):hover {
  border-color: var(--linial-muted) !important;
  background: var(--linial-surface-raised) !important;
  color: var(--linial-text) !important;
}
body.setup-page .setup-composer {
  box-sizing: border-box;
  width: min(calc(100% - 48px), 680px);
  min-height: 60px;
  margin: 0 auto 20px;
  padding: 7px;
  border: 1px solid var(--linial-rule);
  border-radius: 18px;
  background: var(--linial-surface);
  box-shadow: none;
}
body.setup-page .setup-composer::before { display: none; }
body.setup-page .setup-composer[hidden] { display: none !important; }
body.setup-page .setup-composer:focus-within { border-color: var(--setup-accent); box-shadow: 0 0 0 3px #d8bd7833; }
body.setup-page .setup-composer input {
  height: 42px;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: var(--linial-text);
  font-size: 15px;
}
body.setup-page .setup-composer input::placeholder { color: var(--linial-muted); }
body.setup-page .setup-composer button { width: 41px; height: 41px; flex-basis: 41px; border-radius: 12px; background: var(--setup-accent-strong); color: #1b1a15; }
body.setup-page .setup-composer button:hover { background: #e7d096; color: #1b1a15; }
body.setup-page .setup-notice { box-sizing: border-box; width: min(calc(100% - 48px), 680px); margin: 0 auto; padding: 0 0 12px; color: var(--setup-accent); }
@media (max-width: 640px) {
  body.setup-page .setup-head { height: 64px; flex-basis: 64px; padding: 0 17px; }
  body.setup-page .setup-thread { padding: 30px 17px 24px; }
  body.setup-page .setup-composer { width: calc(100% - 34px); margin-bottom: max(12px, env(safe-area-inset-bottom)); }
  body.setup-page .setup-notice { width: calc(100% - 34px); }
}

/* Keep the same anchored conversation surface as onboarding moves from the
   opening prompt to search, matching, review, and setup steps. */
body.setup-page {
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100dvh;
  padding: clamp(32px, 8vh, 76px) 16px 24px;
}
body.setup-page .setup-shell {
  box-sizing: border-box;
  width: min(100%, 760px);
  max-width: 760px;
  min-height: 0;
  margin: 0 auto;
  padding: 0;
}
body.setup-page .setup-conversation {
  box-sizing: border-box;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  border: 1px solid var(--linial-rule) !important;
  border-radius: 12px;
  background: var(--linial-surface) !important;
  box-shadow: 0 1px 3px rgb(26 28 22 / 5%);
}
body.setup-page .setup-head {
  width: 100%;
  max-width: none;
  height: 68px;
  flex: 0 0 68px;
  margin: 0;
  padding: 0 24px;
}
body.setup-page .setup-thread {
  box-sizing: border-box;
  width: 100%;
  max-height: none;
  flex: 0 0 auto;
  overflow: visible;
  padding: 26px 28px 18px;
}
body.setup-page .setup-current {
  min-height: 0;
  align-content: start;
  padding: 0;
}
body.setup-page:has(.setup-introduction) .setup-introduction {
  box-sizing: border-box;
  width: min(100%, 680px);
  max-width: 680px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
}
body.setup-page:has(.setup-introduction) .setup-introduction > p:first-child {
  max-width: 64ch;
  margin: 0;
  color: var(--linial-text) !important;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.58;
}
body.setup-page:has(.setup-introduction) .setup-introduction > p.setup-question {
  max-width: 64ch;
  margin: 22px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--linial-rule);
  color: var(--linial-text) !important;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
}
body.setup-page .setup-composer {
  width: min(calc(100% - 48px), 680px);
  margin: 64px auto 18px;
}
body.setup-page .setup-composer::before {
  left: 0;
  width: 100%;
}
body.setup-page .setup-notice {
  width: min(calc(100% - 48px), 680px);
  margin: 0 auto;
}
body.setup-page .setup-message > .setup-question {
  color: var(--linial-text);
  font-size: 15.5px;
  font-weight: 400;
  line-height: 1.6;
}
body.setup-page .setup-turn-question { font-weight: 400; }
@media (max-width: 640px) {
  body.setup-page {
    padding: max(16px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
  }
  body.setup-page .setup-head { padding-inline: 18px; }
  body.setup-page .setup-head { height: 64px; flex-basis: 64px; }
  body.setup-page .setup-head .sunflower { width: 44px; height: 44px; flex-basis: 44px; }
  body.setup-page .setup-thread { padding: 22px 18px 16px; }
  body.setup-page .setup-composer,
  body.setup-page .setup-notice { width: calc(100% - 36px); }
  body.setup-page .setup-composer { margin-top: 56px; margin-bottom: 14px; }
}

/* Later setup steps share the light-surface contrast and field rhythm. */
body.setup-page .setup-connection-group > p,
body.setup-page .setup-knowledge-topics .setup-knowledge-more > summary,
body.setup-page .setup-knowledge-custom,
body.setup-page .setup-knowledge-selected > span,
body.setup-page .setup-webhook-contract > summary {
  color: var(--linial-muted);
}
body.setup-page #phone-form :is([data-existing-number], [data-native-number]) {
  display: grid;
  gap: 14px;
}
body.setup-page .setup-credentials > label {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
body.setup-page :is(.setup-menu-item, .setup-manual-context, .setup-webhook-contract) {
  border-color: var(--linial-rule);
}
body.setup-page #setup-team-form label > span > small {
  display: inline;
  margin-left: 4px;
  font-size: 12px;
}
@media (max-width: 640px) {
  body.setup-page .setup-menu-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
}
body.setup-page #setup-thread:has(.setup-connection-hub, .setup-knowledge-topics) .setup-history {
  padding-bottom: 24px;
}
body.setup-page .setup-clinic-entry { display: block; width: fit-content; margin-bottom: 14px; }
body.setup-page .setup-source-review .setup-review-detail-footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 6px; }
body.setup-page .setup-source-review .setup-review-detail-footer .setup-review-citations { flex: 1; margin: 0; }
body.setup-page .setup-source-review .setup-remove-detail { flex: 0 0 auto; width: auto !important; margin: 0 !important; min-height: 28px; padding: 2px 0 !important; font-size: 13px; }

/* Existing clinic connection forms share the compact onboarding field rhythm. */
body.setup-page .setup-clinic-connection form { display: grid; gap: 14px; margin: 16px 0; }
body.setup-page .setup-clinic-connection form label { display: grid; gap: 6px; }
body.setup-page .setup-clinic-connection form .clinic-check { display: flex; align-items: flex-start; gap: 9px; }
body.setup-page .setup-clinic-connection .clinic-check input { flex: 0 0 18px; width: 18px; height: 18px; min-height: 18px; margin: 2px 0 0; padding: 0; }
body.setup-page .setup-clinic-connection form button { justify-self: start; }
body.setup-page .setup-clinic-connection [data-scheduler-fields] { display: grid; gap: 14px; }
body.setup-page .setup-clinic-connection [data-scheduler-fields][hidden] { display: none; }
body.setup-page .setup-clinic-connection .clinic-weekdays { display: flex; flex-wrap: wrap; gap: 12px; }

/* Owner-authored workflow steps need room to be entered and reviewed as written. */
body.setup-page #setup-composer [hidden] { display: none !important; }
body.setup-page #setup-composer textarea {
  box-sizing: border-box;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 78px;
  max-height: 240px;
  margin: 0;
  padding: 8px 0;
  resize: vertical;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  color: var(--linial-text) !important;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  outline: 0;
}
body.setup-page #setup-composer textarea::placeholder { color: var(--linial-muted); }
body.setup-page #setup-composer:has(textarea:not([hidden])) { align-items: flex-end; }
