/* Runtime surfaces follow the design's typography and controls. */
.site-registration {
  display: block;
  margin: 0;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  border: 0;
  color: #5c626d;
  font:
    12px/1.6 system-ui,
    sans-serif;
  text-align: center;
}
.site-registration a {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.site-registration a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.site-registration a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 2px;
}
body:has(> .auth-stage) {
  display: grid;
  min-height: 100dvh;
  grid-template-rows: auto minmax(0, 1fr);
}
body:has(> .auth-stage) > .site-header {
  grid-row: 1;
}
body:has(> .auth-stage) > .auth-stage {
  grid-column: 1;
  grid-row: 2;
  padding-bottom: max(64px, env(safe-area-inset-bottom, 0px));
}
body:has(> .auth-stage) > .site-registration {
  grid-column: 1;
  grid-row: 2;
  align-self: end;
  z-index: 2;
}
@media (max-width: 767px) {
  body:has(.mobile-primary-nav) > .site-registration {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
}
.live-notifications {
  margin-top: 24px;
  padding: 24px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
}
.live-notifications h2 {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.5;
}
.live-notification {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px 20px;
  padding: 16px 0;
  border-top: 1px solid var(--line, #e5e7eb);
  font-size: 14px;
  line-height: 1.7;
}
.live-notification > span {
  overflow-wrap: anywhere;
}
.live-notification time {
  grid-column: 1;
  color: var(--text-secondary, #687080);
  font-size: 12px;
}
.live-notification :is(button, small) {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}
.live-action {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line, #d7dce3);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--text, #171a1f);
  font: inherit;
  cursor: pointer;
}
.live-action:disabled {
  opacity: 0.5;
  cursor: wait;
}
.live-action:focus-visible {
  outline: 2px solid var(--agent, #5956d6);
  outline-offset: 3px;
}
@media (max-width: 640px) {
  .live-notifications {
    padding: 16px;
  }
  .live-notification {
    grid-template-columns: minmax(0, 1fr);
  }
  .live-notification :is(button, small) {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }
}
.zhifu-adapter-status {
  position: fixed;
  bottom: 8px;
  left: 12px;
  z-index: 10000;
  padding: 6px 10px;
  border: 1px solid #d7dce3;
  border-radius: 8px;
  background: #fcfcfd;
  color: #596270;
  font:
    11px/1.5 system-ui,
    sans-serif;
  max-width: calc(100vw - 24px);
  box-shadow: 0 2px 8px #171a1f0a;
  cursor: pointer;
}
.zhifu-adapter-status[data-error='true'] {
  color: #b42332;
  border-color: #e4b9c1;
}
.zhifu-adapter-dialog {
  padding: 28px;
  border: 1px solid #d7dce3;
  border-radius: 12px;
  background: #fcfcfd;
  color: #171a1f;
  width: 430px;
  max-width: calc(100vw - 32px);
  max-height: 80vh;
  overflow: auto;
  font:
    14px/1.6 system-ui,
    sans-serif;
  box-shadow: 0 16px 40px #171a1f20;
}
.zhifu-adapter-dialog::backdrop {
  background: #171a1f35;
}
.zhifu-adapter-dialog h2 {
  font-size: 20px;
  margin: 0 0 12px;
}
.zhifu-adapter-dialog p {
  margin: 0 0 18px;
  color: #596270;
}
.zhifu-adapter-dialog button,
.zhifu-adapter-dialog a {
  display: block;
  width: 100%;
  padding: 12px 16px;
  margin: 8px 0;
  border: 1px solid #d7dce3;
  border-radius: 8px;
  background: white;
  color: #171a1f;
  text-decoration: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.zhifu-adapter-dialog button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.zhifu-adapter-dialog small {
  display: block;
  color: #596270;
  font-size: 12px;
}

/* API-backed controls use the same spacing and neutral palette as the V2 prototype. */
:where(.workflow-action, .workflow-dialog button, .draft-delete-action) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  max-width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--line, #dde1e5);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--text, #20252b);
  font: inherit;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
:where(.workflow-action:hover:not(:disabled), .workflow-dialog button:hover:not(:disabled)) {
  background: var(--surface-soft, #f2f4f6);
}
.workflow-action:disabled,
.workflow-dialog button:disabled {
  opacity: 0.45;
  cursor: default;
}
.workflow-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.workflow-field {
  display: grid;
  gap: 6px;
  margin-block: 14px;
  min-width: 0;
  font-size: 13px;
}
.workflow-field
  :is(input:not([type='checkbox']):not([type='radio']):not([type='file']), textarea, select) {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--line, #dde1e5);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: inherit;
  font: inherit;
  line-height: 1.6;
}
.workflow-field textarea {
  resize: vertical;
}
.workflow-field :is(input[type='checkbox'], input[type='radio']) {
  width: 18px;
  height: 18px;
  margin-right: 6px;
}
.workflow-help {
  color: var(--text-secondary, #67717c);
  font-size: 12px;
  line-height: 1.65;
}
.workflow-error {
  white-space: pre-wrap;
  color: var(--danger, #a03030);
}
.workflow-error:empty {
  display: none;
}
.workflow-record p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.workflow-file-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.workflow-file-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line, #e7ece6);
  overflow-wrap: anywhere;
}
.workflow-status {
  padding: 10px 0;
  font-size: 14px;
  line-height: 1.6;
}
.workflow-record {
  padding: 16px 0;
  border-bottom: 1px solid var(--line, #dde1e5);
}
.workflow-dialog {
  box-sizing: border-box;
  border: 1px solid var(--line, #dbe1da);
  border-radius: 18px;
  padding: 24px;
  background: var(--surface, #fff);
  color: var(--text, #1f2923);
  font: inherit;
  width: min(560px, calc(100% - 32px));
  max-height: 85dvh;
  overflow: auto;
}
.workflow-dialog::backdrop {
  background: rgb(21 38 30 / 40%);
}
@media (max-width: 599px) {
  .workflow-dialog {
    padding: 16px;
  }
  .workflow-dialog :is(input, textarea, select) {
    font-size: 16px;
  }
}
.workflow-dialog header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.workflow-dialog header h2 {
  margin: 0;
}
.workflow-dialog button[type='submit'] {
  background: var(--text, #20252b);
  color: var(--surface, #fff);
}
.workflow-dialog footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}
.workflow-dialog footer button,
.zhifu-adapter-dialog button,
.live-action,
.workflow-action {
  border-radius: 12px;
  min-height: 44px;
  padding: 10px 20px;
  font-weight: 500;
}
.workflow-dialog :is([data-confirm], [type='submit']),
.zhifu-adapter-dialog :is(.primary-button, [type='submit']) {
  background: var(--text, #172026);
  border-color: var(--text, #172026);
  color: var(--surface, #fff);
  font-weight: 600;
}
.draft-delete-action {
  margin-block: 12px;
  color: var(--text-secondary, #67717c);
}

/* Agent settings follow the workbench's neutral palette and compact controls. */
.agent-settings-dialog {
  box-sizing: border-box;
  width: min(600px, calc(100% - 32px));
  margin: auto;
  padding: 28px;
  border: 1px solid var(--line, #dde1e5);
  border-radius: 20px;
  color: var(--text, #20252b);
  background: var(--surface, #fff);
  font-size: 14px;
  line-height: 1.65;
}
.agent-settings-dialog::backdrop {
  background: rgb(20 36 31 / 35%);
}
.agent-settings-dialog [hidden] {
  display: none !important;
}
.agent-settings-dialog header {
  align-items: center;
  margin-bottom: 20px;
}
.agent-settings-dialog header h2 {
  font-size: 21px;
  font-weight: 650;
}
.agent-settings-dialog h3 {
  margin: 20px 0 12px;
  font-size: 15px;
}
.agent-settings-dialog p {
  margin: 8px 0;
}
.agent-settings-intro {
  color: var(--text-secondary, #67717c);
}
.agent-settings-dialog fieldset {
  min-width: 0;
  margin: 20px 0;
  padding: 0;
  border: 0;
}
.agent-settings-dialog legend {
  margin-bottom: 8px;
  padding: 0;
  font-weight: 600;
}
.agent-settings-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
}
.agent-settings-check input[type='checkbox'] {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  margin: 3px 0 0;
  accent-color: var(--text, #20252b);
}
.agent-settings-check span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.agent-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.agent-settings-dialog .workflow-field {
  margin: 8px 0;
  font-size: 13px;
}
.agent-settings-dialog input {
  box-sizing: border-box;
}
.agent-settings-dialog .workflow-help {
  font-size: 13px;
}
.agent-settings-details {
  margin-top: 18px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line, #dde1e5);
}
.agent-settings-details summary {
  cursor: pointer;
  color: var(--text-secondary, #67717c);
  font-size: 13px;
}
.agent-settings-details[open] summary {
  margin-bottom: 16px;
}
.agent-settings-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
.agent-settings-footer button {
  min-width: 104px;
}
.agent-settings-dialog .agent-settings-primary {
  background: var(--text, #20252b);
  color: var(--surface, #fff);
}
.agent-settings-facts {
  margin: 12px 0;
}
.agent-settings-facts > div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line, #dde1e5);
}
.agent-settings-facts dt {
  color: var(--text-secondary, #67717c);
}
.agent-settings-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.agent-settings-facts small {
  display: block;
  color: var(--text-secondary, #67717c);
  font-size: 12px;
}
.agent-settings-consent {
  margin-top: 20px;
}
.agent-settings-status strong {
  font-size: 15px;
}
.agent-settings-dialog :focus-visible {
  outline: 2px solid #34695b;
  outline-offset: 3px;
}
@media (max-width: 480px) {
  .agent-settings-dialog {
    padding: 20px;
    max-height: 90dvh;
    border-radius: 16px;
  }
  .agent-settings-dialog header h2 {
    font-size: 19px;
  }
  .agent-settings-grid {
    gap: 12px;
  }
  .agent-settings-facts > div {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
  }
  .agent-settings-footer button {
    flex: 1;
  }
}

.agent-settings-dialog [data-close] {
  font-size: 26px;
  line-height: 1;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 50%;
}
.agent-settings-dialog input:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px #171b1e;
  border-color: #171b1e;
}
.agent-settings-dialog [data-preview]:hover {
  background: #30373c;
  transform: none;
}
.account-menu button.account-menu__row {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.agent-switch-control[data-disabled-reason]:not([data-disabled-reason='']) {
  position: relative;
}
.agent-switch-control[data-disabled-reason]:not([data-disabled-reason='']):hover::after {
  content: attr(data-disabled-reason);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 200px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #171b1e;
  color: #fff;
  font-size: 12px;
  pointer-events: none;
  z-index: 5;
}
/* Runtime controls share a palette; imported .primary-button keeps its prototype states. */
:root :is(.secondary-button, .button--secondary, .dialog-button--secondary) {
  border-color: var(--v1-button-secondary-border, #c2c7d0);
}
/* Native disabled controls remain readable; their interaction is still disabled. */
:root :is(button, input[type='button'], input[type='submit']):disabled:not(.primary-button) {
  color: var(--v1-text-secondary, #596270);
  opacity: 1;
  cursor: not-allowed;
}
:root
  :is(
    .button--primary,
    .dialog-button--primary,
    .auth-primary,
    .evidence-primary,
    .agent-settings-primary,
    .submit-button,
    .primary-action,
    .workflow-action--primary,
    .primary,
    .candidate__confirm,
    .client-first-requirement__primary,
    .composer-send-button,
    .send-button,
    .completion-rail__action,
    .publish-entry--primary .publish-entry__trigger,
    .workflow-dialog [data-confirm],
    .workflow-dialog button[type='submit'],
    .zhifu-adapter-dialog button[type='submit']
  ):not(.button--danger):not(.dialog-button--danger):not(.evidence-danger) {
  background: var(--v1-button-primary-background, #171a1f);
  border-color: var(--v1-button-primary-background, #171a1f);
  color: var(--v1-button-primary-foreground, #fcfcfd);
  &:hover:not(:disabled) {
    background: var(--v1-button-primary-hover, #303641);
    border-color: var(--v1-button-primary-hover, #303641);
    color: var(--v1-button-primary-foreground, #fcfcfd);
  }
  &:active:not(:disabled) {
    background: var(--v1-button-primary-pressed, #0f1216);
    border-color: var(--v1-button-primary-pressed, #0f1216);
    color: var(--v1-button-primary-foreground, #fcfcfd);
  }
  &:focus-visible {
    outline: 2px solid var(--v1-text-strong, #171a1f);
    outline-offset: 3px;
  }
  &:disabled {
    background: var(--v1-surface-muted, #f2f3f5);
    border-color: var(--v1-button-disabled-border, #d9dee5);
    color: var(--v1-text-secondary, #596270);
    opacity: 1;
  }
}
:root :is(.button--danger, .dialog-button--danger, .evidence-danger):disabled {
  background: var(--v1-surface-muted, #f2f3f5);
  border-color: var(--v1-button-disabled-border, #d9dee5);
  color: var(--v1-text-secondary, #596270);
  opacity: 1;
}

/* Native pickers keep their behavior, with the same control language as the app. */
input[type='file'] {
  max-width: 100%;
  font: inherit;
  color: inherit;
}
input[type='file']::file-selector-button {
  min-height: 44px;
  margin-right: 12px;
  padding: 10px 16px;
  border: 1px solid var(--v1-button-secondary-border, #c2c7d0);
  border-radius: 8px;
  background: transparent;
  color: var(--v1-text-strong, #171a1f);
  font: inherit;
  cursor: pointer;
}
input[type='file']::file-selector-button:hover {
  background: var(--v1-surface-muted, #f2f3f5);
}
input[type='file']:disabled::file-selector-button {
  background: var(--v1-surface-muted, #f2f3f5);
  border-color: var(--v1-button-disabled-border, #d9dee5);
  color: var(--v1-text-secondary, #596270);
  cursor: not-allowed;
}

.conversation-title {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.conversation-title h1 {
  margin: 0;
  min-width: 0;
}
.conversation-title .title-return {
  margin: 0;
  padding: 4px;
  flex: 0 0 32px;
  width: 32px;
  min-height: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  text-decoration: none;
}
.conversation-title .title-return[hidden] {
  display: none;
}
.conversation-title .title-return span {
  display: none;
}
.conversation-title .title-return svg {
  width: 16px;
  height: 16px;
}
.conversation-title .title-return--reverse svg {
  transform: rotate(180deg);
}
[data-summary] .agent-settings-facts > div {
  gap: 9px;
  border-bottom: 0;
}
.agent-confirmation-boundary {
  font-weight: 650;
  color: #9a5b12;
}
.agent-confirmation-boundary > span {
  display: inline-flex;
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
}

.task-context:has(.conversation-title) .title-row {
  margin-top: 0;
  align-items: center;
}
.detail-backbar[hidden],
.detail-mobile-bar[hidden] {
  display: none;
}
.detail-heading:has(.conversation-title) > div:first-child {
  min-width: 0;
}
.detail-heading .conversation-title h1 {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}
body:has(> :is(.page, .client-page, .cooperation-page, .account-page)) {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
body:has(> :is(.page, .client-page, .cooperation-page, .account-page)) > .site-registration {
  margin-top: auto;
}

/* ============================================================
 * 2026-11-12 反馈 184：头像统一圆形裁切 + 统一降级
 * 容器统一圆裁，图片统一 cover；无头像/加载失败统一中性底色 + 首字。
 * 覆盖：工作台洽谈中/已发送、需求列表候选卡、合作列表行、参与者头像。
 * ============================================================ */
.counterpart-avatar,
.thread-row__avatar,
.candidate__avatar,
.mini-avatar,
.message__avatar,
.avatar-initial,
.client-home-avatar,
.account-menu__avatar,
.profile-header__avatar {
  position: relative;
  overflow: hidden;
  border-radius: 50%;
  box-sizing: border-box;
}
.counterpart-avatar img,
.thread-row__avatar img,
.candidate__avatar img,
.mini-avatar img,
.message__avatar img,
.avatar-initial img,
.client-home-avatar img,
.account-menu__avatar img,
.profile-header__avatar img,
[data-avatar-owner] img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
}
.is-avatar-fallback {
  background: var(--surface-strong, #eef1f4);
  color: var(--text-secondary, #52606d);
  font-weight: 700;
}
