/**
 * 常用组件：表单 / Toast / 弹窗 / 确认框 / 下拉菜单 / Tabs /
 * Chip·Badge / Alert / 面包屑 / Avatar / Progress / Tooltip / FAQ
 * 自 home 精简；按需在页内挂链。
 */

/* —— 表单项 —— */
.wa-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 28rem;
}

.wa-form-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wa-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--wa-color-text);
}

.wa-label .wa-req {
  margin-left: 2px;
  color: var(--wa-color-danger, #f53f3f);
}

.wa-field__hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--wa-color-muted);
}

.wa-field__error {
  display: none;
  margin: 0;
  font-size: 0.8125rem;
  color: var(--wa-color-danger, #f53f3f);
}

.wa-form-item.is-error .wa-field__error {
  display: block;
}

.wa-form-item.is-error .wa-field__hint {
  display: none;
}

/* —— 输入域 —— */
.wa-field {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0 10px 0 14px;
  border: 1px solid var(--wa-color-border-2, var(--wa-color-border));
  border-radius: var(--wa-input-radius, 8px);
  background: var(--wa-color-surface);
  transition: border-color var(--wa-duration) var(--wa-ease), box-shadow var(--wa-duration) var(--wa-ease);
}

.wa-field:hover:not(:focus-within) {
  border-color: color-mix(in srgb, var(--wa-color-primary) 42%, var(--wa-color-border-2, var(--wa-color-border)));
}

.wa-field:focus-within {
  border-color: var(--wa-color-primary);
  box-shadow: 0 0 0 var(--wa-ctrl-ring, 3px) var(--wa-color-primary-soft);
}

.wa-form-item.is-error .wa-field:hover:not(:focus-within),
.wa-field.is-error:hover:not(:focus-within) {
  border-color: color-mix(in srgb, var(--wa-color-danger, #f53f3f) 72%, var(--wa-color-border));
}

.wa-form-item.is-error .wa-field,
.wa-field.is-error {
  border-color: var(--wa-color-danger, #f53f3f);
}

.wa-form-item.is-error .wa-field:focus-within,
.wa-field.is-error:focus-within {
  border-color: var(--wa-color-danger, #f53f3f);
  box-shadow: 0 0 0 var(--wa-ctrl-ring, 3px) color-mix(in srgb, var(--wa-color-danger, #f53f3f) 22%, transparent);
}

.wa-field__icon {
  display: none;
  flex: 0 0 auto;
  font-size: 0.9375rem;
  line-height: 1;
  color: var(--wa-color-text-secondary);
  opacity: 0.75;
  pointer-events: none;
}

.wa-field--icon .wa-field__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wa-field--icon:focus-within .wa-field__icon {
  color: var(--wa-color-primary);
  opacity: 1;
}

.wa-field__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--wa-color-text);
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  outline: none;
}

.wa-field__input::placeholder {
  color: var(--wa-color-muted);
  opacity: 0.85;
}

.wa-field__clear {
  flex: 0 0 auto;
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--wa-color-muted);
  cursor: pointer;
}

.wa-field__clear.is-visible {
  display: inline-flex;
}

.wa-field__clear:hover {
  color: var(--wa-color-text);
}

.wa-field--textarea {
  align-items: flex-start;
  min-height: 0;
  padding: 10px 14px;
}

.wa-field__textarea {
  flex: 1 1 auto;
  width: 100%;
  min-height: 96px;
  margin: 0;
  padding: 0;
  border: 0;
  resize: vertical;
  background: transparent;
  color: var(--wa-color-text);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
}

.wa-field__textarea::placeholder {
  color: var(--wa-color-muted);
  opacity: 0.85;
}

.wa-field--select {
  position: relative;
  padding-right: 12px;
}

.wa-field__select {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 42px;
  margin: 0;
  padding: 0 28px 0 0;
  border: 0;
  background: transparent;
  color: var(--wa-color-text);
  font: inherit;
  font-size: 14px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* —— 自定义下拉（替代原生 option 系统蓝） ——
 * 列表挂在 .wa-field--select（position:relative）下拉满描边框宽；
 * .wa-combo 用 static，避免列表只跟内层内容区同宽。 */
.wa-combo {
  position: static;
  width: 100%;
}

.wa-combo__native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wa-combo__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 0 4px 0 0;
  border: 0;
  background: transparent;
  color: var(--wa-color-text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.wa-combo__value.is-placeholder {
  color: var(--wa-color-muted);
}

.wa-combo__chevron {
  flex: 0 0 auto;
  font-size: 0.625rem;
  color: var(--wa-color-muted);
  opacity: 0.72;
  transition: transform var(--wa-duration) var(--wa-ease);
}

.wa-combo__trigger[aria-expanded="true"] .wa-combo__chevron {
  transform: rotate(180deg);
}

.wa-combo__list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  width: auto;
  box-sizing: border-box;
  z-index: 40;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--wa-color-border);
  border-radius: var(--wa-radius-sm, 6px);
  background: var(--wa-color-surface);
  box-shadow: var(--wa-shadow-soft);
  max-height: 220px;
  overflow-y: auto;
}

.wa-combo__list[hidden] {
  display: none;
}

.wa-combo__list li {
  margin: 0;
  padding: 0;
}

.wa-combo__option {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--wa-radius-sm, 6px);
  background: transparent;
  color: var(--wa-color-text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background var(--wa-duration-fast, 150ms) ease, color var(--wa-duration-fast, 150ms) ease;
}

.wa-combo__option:hover,
.wa-combo__option:focus-visible {
  outline: none;
  background: var(--wa-color-fill-1);
}

.wa-combo__option[aria-selected="true"] {
  background: var(--wa-color-primary-soft);
  color: var(--wa-color-primary);
  font-weight: 600;
}

.wa-field--select.is-open,
.wa-field:has(.wa-combo__trigger[aria-expanded="true"]) {
  border-color: color-mix(in srgb, var(--wa-color-primary) 45%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--wa-color-primary) 20%, transparent);
}

/* —— 复选 / 单选（原生 input + 自绘，跟主色） —— */
.wa-check,
.wa-radio {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--wa-color-text-secondary);
  cursor: pointer;
}

.wa-check input,
.wa-radio input {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--wa-color-border-2, var(--wa-color-border));
  background: var(--wa-color-surface);
  color: var(--wa-color-on-primary);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition:
    border-color var(--wa-duration-fast, 150ms) ease,
    background var(--wa-duration-fast, 150ms) ease,
    box-shadow var(--wa-duration-fast, 150ms) ease;
}

.wa-check input {
  border-radius: 3px;
}

.wa-radio input {
  border-radius: 50%;
}

.wa-check input:hover,
.wa-radio input:hover {
  border-color: color-mix(in srgb, var(--wa-color-primary) 45%, var(--wa-color-border));
}

.wa-check input:focus-visible,
.wa-radio input:focus-visible {
  outline: 2px solid var(--wa-color-primary);
  outline-offset: 2px;
}

.wa-check input:checked {
  border-color: var(--wa-color-primary);
  background-color: var(--wa-color-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2.5 6.2 5 8.7 9.5 3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
}

/* 单选选中：主色实心圆 + 中心白点 */
.wa-radio input:checked {
  border-color: var(--wa-color-primary);
  background-color: var(--wa-color-primary);
  background-image: radial-gradient(
    circle,
    #fff 0 3.5px,
    var(--wa-color-primary) 4px
  );
}

.wa-radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* —— 开关（原生 checkbox + 自绘轨道） —— */
.wa-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--wa-color-text-secondary);
  cursor: pointer;
  user-select: none;
}

.wa-switch input {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 40px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--wa-color-border-2, var(--wa-color-border)) 55%, transparent);
  border-radius: 999px;
  background: var(--wa-color-fill-1, color-mix(in srgb, var(--wa-color-muted) 14%, transparent));
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  position: relative;
  transition:
    background 0.18s ease,
    border-color 0.18s ease;
}

.wa-switch input::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px color-mix(in srgb, #000 18%, transparent);
  transform: translateY(-50%);
  transition: transform 0.18s ease;
}

.wa-switch input:hover {
  border-color: color-mix(in srgb, var(--wa-color-primary) 28%, var(--wa-color-border));
}

.wa-switch input:focus-visible {
  outline: 2px solid var(--wa-color-primary);
  outline-offset: 2px;
}

.wa-switch input:checked {
  border-color: var(--wa-color-primary);
  background: var(--wa-color-primary);
}

.wa-switch input:checked::after {
  transform: translate(18px, -50%);
}

.wa-switch input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.wa-switch-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wa-switch-group--inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

/* —— 下拉菜单（操作菜单，非表单 select） —— */
.wa-dropdown {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  z-index: 1;
}

.wa-dropdown.is-open {
  z-index: 30;
}

.wa-dropdown__trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wa-dropdown__trigger .wa-dropdown__chevron {
  font-size: 0.625rem;
  opacity: 0.72;
  transition: transform 0.15s ease;
}

.wa-dropdown.is-open .wa-dropdown__chevron {
  transform: rotate(180deg);
}

.wa-dropdown__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  min-width: 168px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--wa-color-border);
  border-radius: 10px;
  background: var(--wa-color-surface);
  box-shadow: 0 6px 20px color-mix(in srgb, #000 10%, transparent);
}

.wa-dropdown__menu[hidden] {
  display: none;
}

.wa-dropdown__menu--end {
  left: auto;
  right: 0;
}

.wa-dropdown__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 9px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--wa-color-text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.wa-dropdown__item:hover,
.wa-dropdown__item:focus-visible {
  outline: none;
  background: var(--wa-color-fill-1);
  color: var(--wa-color-text);
}

.wa-dropdown__item i {
  width: 1em;
  text-align: center;
  color: var(--wa-color-text-secondary, var(--wa-color-muted));
  font-size: 0.875rem;
}

.wa-dropdown__item--danger {
  color: var(--wa-color-danger, #ef4444);
}

.wa-dropdown__item--danger i {
  color: inherit;
}

.wa-dropdown__item--danger:hover,
.wa-dropdown__item--danger:focus-visible {
  background: color-mix(in srgb, var(--wa-color-danger, #ef4444) 10%, transparent);
  color: var(--wa-color-danger, #ef4444);
}

.wa-dropdown__sep {
  display: block;
  height: 1px;
  margin: 5px 8px;
  border: 0;
  background: color-mix(in srgb, var(--wa-color-border) 68%, transparent);
}

html[data-theme="dark"] .wa-dropdown__menu {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

/* —— 分段 Tabs（对齐 home 首页胶囊切换） —— */
.wa-tabs {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
}

.wa-tabs__list {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid color-mix(in srgb, var(--wa-color-border) 90%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--wa-color-muted, #94a3b8) 8%, var(--wa-color-surface, #fff));
}

.wa-tabs__tab {
  margin: 0;
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--wa-color-text-secondary, var(--wa-color-muted));
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.wa-tabs__tab:hover {
  color: var(--wa-color-text);
}

.wa-tabs__tab.is-active {
  background: var(--wa-color-surface, #fff);
  color: var(--wa-color-text);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--wa-color-text) 8%, transparent);
}

.wa-tabs__tab:focus-visible {
  outline: 2px solid var(--wa-color-primary);
  outline-offset: 2px;
}

html[data-theme="dark"] .wa-tabs__list {
  background: color-mix(in srgb, var(--wa-color-muted) 14%, transparent);
}

html[data-theme="dark"] .wa-tabs__tab.is-active {
  background: color-mix(in srgb, var(--wa-color-surface) 92%, transparent);
  box-shadow: none;
}

.wa-tabs__panels {
  width: 100%;
  min-width: 0;
}

.wa-tabs__panel {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--wa-color-text-secondary, var(--wa-color-muted));
}

.wa-tabs__panel[hidden] {
  display: none;
}

/* —— Chip / Badge —— */
.wa-chip,
.wa-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--wa-color-border);
  border-radius: 999px;
  background: transparent;
  color: var(--wa-color-text-secondary, var(--wa-color-muted));
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  vertical-align: middle;
}

.wa-chip--accent,
.wa-badge--accent {
  background: var(--wa-color-primary);
  border-color: var(--wa-color-primary);
  color: var(--wa-color-primary-contrast, #fff);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.wa-chip--marked {
  background: color-mix(in srgb, var(--wa-color-primary) 10%, transparent);
  border-color: color-mix(in srgb, var(--wa-color-primary) 45%, transparent);
  color: var(--wa-color-primary);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--wa-color-primary) 15%, transparent);
}

.wa-badge--outline {
  background: transparent;
  border-color: var(--wa-color-border);
  color: var(--wa-color-muted);
}

.wa-chip-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.wa-chip--option {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  cursor: pointer;
  font-family: inherit;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.wa-chip--option:hover:not(.is-active) {
  transform: translateY(-1px);
}

.wa-chip--option:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--wa-color-primary) 45%, transparent);
  outline-offset: 2px;
}

/* —— Alert —— */
.wa-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--wa-color-border);
  border-radius: var(--wa-radius-md, 12px);
  background: transparent;
  color: var(--wa-color-text);
  font-size: 13px;
  line-height: 1.55;
}

.wa-alert__mark {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15em;
  height: 1.55em; /* 对齐正文首行行盒 */
  margin: 0;
  font-size: 1em;
  font-weight: 400;
  line-height: 1;
  color: var(--wa-color-primary);
}

.wa-alert__body {
  min-width: 0;
  flex: 1;
  padding-top: 0;
  line-height: 1.55;
}

.wa-alert--strong {
  background: var(--wa-color-primary);
  border-color: var(--wa-color-primary);
  color: var(--wa-color-primary-contrast, #fff);
  font-weight: 700;
}

.wa-alert--strong .wa-alert__mark {
  color: inherit;
}

/* —— 面包屑 —— */
.wa-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--wa-color-text-secondary, var(--wa-color-muted));
}

.wa-crumbs__sep {
  opacity: 0.7;
  user-select: none;
}

.wa-crumbs__current {
  color: var(--wa-color-text);
  font-weight: 600;
}

.wa-crumbs a {
  color: inherit;
  text-decoration: none;
}

.wa-crumbs a:hover {
  color: var(--wa-color-primary);
}

/* —— Avatar —— */
.wa-avatar-group {
  display: inline-flex;
  align-items: center;
}

.wa-avatar {
  width: 36px;
  height: 36px;
  margin-left: -8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--wa-color-surface, #fff);
  border-radius: 50%;
  background: var(--wa-color-primary);
  color: var(--wa-color-primary-contrast, #fff);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.wa-avatar-group .wa-avatar:first-child {
  margin-left: 0;
}

.wa-avatar--strong {
  background: color-mix(in srgb, var(--wa-color-text) 72%, transparent);
}

.wa-avatar--muted {
  background: color-mix(in srgb, var(--wa-color-muted) 85%, var(--wa-color-text) 15%);
}

/* —— Progress —— */
.wa-progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--wa-color-text) 6%, transparent);
}

.wa-progress__bar {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--wa-color-primary);
}

.wa-progress-seg {
  display: flex;
  gap: 4px;
  width: 100%;
  height: 12px;
}

.wa-progress-seg__item {
  flex: 1;
  min-width: 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--wa-color-text) 6%, transparent);
}

.wa-progress-seg__item:first-child {
  border-radius: 999px 0 0 999px;
}

.wa-progress-seg__item:last-child {
  border-radius: 0 999px 999px 0;
}

.wa-progress-seg__item.is-on {
  background: var(--wa-color-primary);
}

html[data-theme="dark"] .wa-progress,
html[data-theme="dark"] .wa-progress-seg__item {
  background: color-mix(in srgb, #fff 10%, transparent);
}

html[data-theme="dark"] .wa-progress-seg__item.is-on {
  background: var(--wa-color-primary);
}

/* —— Tip：任意宿主悬停提示（不改外观；data-tip 文案） —— */
.wa-tip {
  position: relative;
  --wa-tip-bg: #1c1d22;
  --wa-tip-fg: #fff;
  --wa-tip-fs: 12px;
  --wa-tip-fw: 400;
}

.wa-tip[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  z-index: 61;
  transform: translateX(-50%);
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--wa-tip-bg);
  color: var(--wa-tip-fg);
  font-size: var(--wa-tip-fs);
  font-weight: var(--wa-tip-fw);
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.28),
    0 2px 8px rgba(0, 0, 0, 0.18);
  transition: opacity 0.18s ease;
}

.wa-tip[data-tip]::before {
  content: "";
  position: absolute;
  left: 50%;
  /* 箭头压在气泡下方并略重叠，避免接缝发虚 */
  z-index: 60;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-style: solid;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

/* 默认下方：箭头底边伸进气泡 1px */
.wa-tip[data-tip]::after,
.wa-tip--below[data-tip]::after {
  top: calc(100% + 8px);
  bottom: auto;
}

.wa-tip[data-tip]::before,
.wa-tip--below[data-tip]::before {
  top: calc(100% + 3px);
  bottom: auto;
  border-width: 0 5px 6px;
  border-color: transparent transparent var(--wa-tip-bg);
}

.wa-tip--above[data-tip]::after {
  top: auto;
  bottom: calc(100% + 8px);
}

.wa-tip--above[data-tip]::before {
  top: auto;
  bottom: calc(100% + 3px);
  border-width: 6px 5px 0;
  border-color: var(--wa-tip-bg) transparent transparent;
}

.wa-tip--light {
  --wa-tip-bg: color-mix(in srgb, var(--wa-color-surface, #fff) 92%, transparent);
  --wa-tip-fg: var(--wa-color-text);
}

.wa-tip--dark {
  --wa-tip-bg: #1c1d22;
  --wa-tip-fg: #fff;
}

.wa-tip:hover,
.wa-tip:focus-visible {
  z-index: 50;
}

.wa-tip:hover[data-tip]::after,
.wa-tip:hover[data-tip]::before,
.wa-tip:focus-visible[data-tip]::after,
.wa-tip:focus-visible[data-tip]::before {
  opacity: 1;
}

/* —— Tooltip 示意钮（橱窗用圆形帮助标记；业务悬停请用 .wa-tip） —— */
.wa-tooltip {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--wa-color-border);
  border-radius: 50%;
  background: color-mix(in srgb, var(--wa-color-text) 4%, transparent);
  color: var(--wa-color-text-secondary, var(--wa-color-muted));
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: help;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  --wa-tooltip-bg: color-mix(in srgb, var(--wa-color-surface, #fff) 82%, transparent);
}

html[data-theme="dark"] .wa-tooltip {
  --wa-tooltip-bg: color-mix(in srgb, var(--wa-color-surface, #1a1a1a) 86%, transparent);
}

.wa-tooltip:hover,
.wa-tooltip:focus-within,
.wa-tooltip:focus-visible {
  z-index: 50;
  outline: none;
}

.wa-tooltip:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--wa-color-primary) 45%, transparent);
}

.wa-tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  z-index: 40;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--wa-tooltip-bg);
  color: var(--wa-color-text);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow:
    0 10px 28px color-mix(in srgb, var(--wa-color-text) 12%, transparent),
    0 2px 8px color-mix(in srgb, var(--wa-color-text) 6%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.18s ease;
}

.wa-tooltip::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  z-index: 41;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-style: solid;
  border-width: 6px 5px 0;
  border-color: var(--wa-tooltip-bg) transparent transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.wa-tooltip:hover::after,
.wa-tooltip:hover::before,
.wa-tooltip:focus-within::after,
.wa-tooltip:focus-within::before,
.wa-tooltip:focus-visible::after,
.wa-tooltip:focus-visible::before {
  opacity: 1;
}

html[data-theme="dark"] .wa-tooltip::after {
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.45),
    0 2px 8px rgba(0, 0, 0, 0.28);
}

/* —— FAQ —— */
.wa-faq {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: none;
  background: transparent;
  box-shadow: none;
}

.wa-faq__item {
  overflow: hidden;
  border-radius: var(--wa-radius);
}

.wa-faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin: 0;
  padding: 16px 18px;
  border: 0;
  background: transparent;
  color: var(--wa-color-text-1);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.wa-faq__q:focus-visible {
  outline: 2px solid var(--wa-color-primary);
  outline-offset: -2px;
}

.wa-faq__label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.wa-faq__index {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--wa-color-primary);
  color: var(--wa-color-primary);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.wa-faq__toggle {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(0, 0, 0, 0.02);
  color: var(--wa-color-text-secondary);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
}

.wa-faq__toggle::before {
  content: "+";
}

html[data-theme="dark"] .wa-faq__toggle {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.wa-faq__item.is-open .wa-faq__toggle {
  color: var(--wa-color-primary);
  border-color: rgba(var(--wa-color-primary-rgb), 0.18);
  background: rgba(var(--wa-color-primary-rgb), 0.06);
}

.wa-faq__item.is-open .wa-faq__toggle::before {
  content: "×";
}

.wa-faq__a {
  display: none;
  padding: 0 18px 18px 52px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--wa-color-text-secondary);
}

.wa-faq__item.is-open .wa-faq__a {
  display: block;
}

@media (max-width: 640px) {
  .wa-faq__a {
    padding-left: 18px;
  }
}

/* —— Toast —— */
.wa-toast-host {
  position: fixed;
  top: 20px;
  left: 50%;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(92vw, 420px);
  transform: translateX(-50%);
  pointer-events: none;
}

.wa-toast {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  width: max-content;
  max-width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  background: var(--wa-color-surface);
  color: var(--wa-color-text);
  box-shadow: var(--wa-shadow-soft);
  pointer-events: auto;
  animation: wa-toast-in 0.22s ease both;
}

.wa-toast.is-leaving {
  animation: wa-toast-out 0.18s ease both;
}

.wa-toast__icon {
  flex: 0 0 auto;
  margin-top: 1px;
  font-size: 1rem;
  line-height: 1;
}

.wa-toast__text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.wa-toast--info .wa-toast__icon {
  color: var(--wa-color-primary);
}

.wa-toast--success .wa-toast__icon {
  color: var(--wa-color-success, #00b42a);
}

.wa-toast--warning .wa-toast__icon {
  color: var(--wa-color-warning, #ff7d00);
}

.wa-toast--error .wa-toast__icon {
  color: var(--wa-color-danger, #f53f3f);
}

@keyframes wa-toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes wa-toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

/* —— 弹窗 —— */
.wa-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
}

.wa-modal.is-open {
  display: block;
}

.wa-modal__overlay {
  position: absolute;
  inset: 0;
  background: var(--wa-mask-bg, color-mix(in srgb, #000 32%, transparent));
  -webkit-backdrop-filter: blur(var(--wa-mask-blur, 4px));
  backdrop-filter: blur(var(--wa-mask-blur, 4px));
}

.wa-modal.is-open .wa-modal__overlay {
  animation: wa-modal-overlay-in 220ms ease both;
}

.wa-modal__panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate3d(-50%, -50%, 0);
  width: min(560px, calc(100vw - 32px));
  max-height: min(78vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--wa-color-border) 88%, transparent);
  border-radius: var(--wa-radius-lg);
  background: var(--wa-color-surface);
  color: var(--wa-color-text);
  box-shadow: var(--wa-shadow-soft);
}

.wa-modal.is-open .wa-modal__panel {
  animation: wa-modal-in 280ms ease both;
}

@keyframes wa-modal-in {
  from {
    opacity: 0;
    transform: translate3d(-50%, calc(-50% + 10px), 0) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translate3d(-50%, -50%, 0) scale(1);
  }
}

@keyframes wa-modal-dialog-in {
  from {
    opacity: 0;
    transform: translate3d(-50%, calc(-50% + 10px), 0) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translate3d(-50%, -50%, 0) scale(1);
  }
}

@keyframes wa-modal-overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.wa-modal__header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: 12px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--wa-color-border) 85%, transparent);
}

.wa-modal__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--wa-color-text);
}

.wa-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--wa-color-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.wa-modal__close:hover,
.wa-modal__close:focus-visible {
  background: color-mix(in srgb, var(--wa-color-muted) 14%, transparent);
  color: var(--wa-color-text);
  outline: none;
}

/* 打开弹窗会 focus 关闭钮；勿让 :focus 盖过 :hover（特异性更高） */
.wa-modal__close:focus:not(:focus-visible):not(:hover) {
  outline: none;
  background: transparent;
  color: var(--wa-color-muted);
}

.wa-modal__panel:focus {
  outline: none;
}

.wa-modal__body {
  flex: 1 1 auto;
  padding: 16px 18px 20px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.wa-modal__footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid color-mix(in srgb, var(--wa-color-border) 85%, transparent);
}

/* —— 确认框（WA_CONFIRM；图标 + 标题/说明 + 取消/确定） —— */
.wa-modal--confirm {
  z-index: 1100;
}

.wa-modal--confirm .wa-modal__panel {
  position: absolute;
  width: min(400px, calc(100vw - 32px));
  max-height: none;
  padding: 22px 22px 18px;
  border-radius: 14px;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--wa-color-border) 70%, transparent),
    0 18px 48px color-mix(in srgb, #000 14%, transparent);
}

.wa-modal--confirm .wa-modal__close--corner {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.wa-modal--confirm .wa-modal__body--confirm {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 4px 28px 0 0;
  overflow: visible;
}

.wa-modal--confirm .wa-modal__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  background: none;
  border-radius: 0;
  font-size: 1.5rem;
  line-height: 1;
}

.wa-modal--confirm-info .wa-modal__icon {
  color: var(--wa-color-primary);
}

.wa-modal--confirm-warning .wa-modal__icon {
  color: var(--wa-color-warning, #ff7d00);
}

.wa-modal--confirm-danger .wa-modal__icon {
  color: var(--wa-color-danger, #ef4444);
}

.wa-modal--confirm .wa-modal__copy {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 2px;
}

.wa-modal--confirm .wa-modal__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.wa-modal--confirm .wa-modal__message {
  margin: 8px 0 0;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--wa-color-text-secondary, var(--wa-color-muted));
}

.wa-modal--confirm .wa-modal__footer {
  gap: 8px;
  margin-top: 20px;
  padding: 0;
  border-top: none;
}

.wa-modal--confirm .wa-modal__footer .wa-btn {
  min-height: 36px;
  padding: 0 16px;
  font-size: 13px;
  border-radius: 8px;
}

.wa-modal--confirm .wa-btn--danger {
  background: var(--wa-color-danger, #ef4444);
  border-color: var(--wa-color-danger, #ef4444);
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--wa-color-danger, #ef4444) 26%, transparent);
}

.wa-modal--confirm .wa-btn--danger:hover {
  background: color-mix(in srgb, var(--wa-color-danger, #ef4444) 88%, #000);
  border-color: color-mix(in srgb, var(--wa-color-danger, #ef4444) 88%, #000);
  color: #fff;
}

/* 微信弹窗：居中对话框 + 下方关闭（对齐 Pro） */
.wa-modal__dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate3d(-50%, -50%, 0);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(360px, calc(100vw - 40px));
}

.wa-modal.is-open .wa-modal__dialog {
  animation: wa-modal-dialog-in 220ms var(--wa-ease, ease) both;
}

.wa-modal--wechat .wa-modal__overlay {
  background: rgba(15, 23, 42, 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

html[data-theme="dark"] .wa-modal--wechat .wa-modal__overlay {
  background: rgba(0, 0, 0, 0.62);
}

.wa-modal--wechat .wa-modal__panel {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  width: 100%;
  max-height: none;
  overflow: visible;
  border-radius: var(--wa-radius);
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  text-align: center;
  animation: none !important;
}

html[data-theme="dark"] .wa-modal--wechat .wa-modal__panel {
  background: #161322;
  border-color: rgba(255, 255, 255, 0.12);
}

.wa-modal__body--wechat {
  padding: 36px 22px 40px;
  text-align: center;
  overflow: visible;
}

.wa-modal__wechat-title {
  margin: 0 0 6px;
  font-family: var(--wa-font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--wa-color-text-1);
}

.wa-modal__desc {
  margin: 0 0 22px;
  padding: 0 12px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--wa-color-text-secondary);
}

.wa-modal__qr {
  display: inline-block;
  margin: 0 auto;
  padding: 4px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  line-height: 0;
}

html[data-theme="dark"] .wa-modal__qr {
  border-color: rgba(255, 255, 255, 0.12);
}

.wa-modal__qr img {
  display: block;
  width: 200px;
  height: 200px;
  object-fit: contain;
  border-radius: 0;
}

/* 浮动关闭：完全覆盖通用 .wa-modal__close 悬停，避免灰底+亮白环叠层 */
.wa-modal .wa-modal__close.wa-modal__close--float {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  box-shadow: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.wa-modal .wa-modal__close.wa-modal__close--float i {
  color: inherit;
  pointer-events: none;
}

.wa-modal .wa-modal__close.wa-modal__close--float:hover,
.wa-modal .wa-modal__close.wa-modal__close--float:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.55);
  color: #ffffff;
  outline: none;
  box-shadow: none;
}

.wa-modal .wa-modal__close.wa-modal__close--float:focus,
.wa-modal .wa-modal__close.wa-modal__close--float:focus:not(:focus-visible) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.42);
  color: rgba(255, 255, 255, 0.88);
  outline: none;
  box-shadow: none;
}

.wa-modal .wa-modal__close.wa-modal__close--float:hover:focus {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.55);
  color: #ffffff;
}

.wa-modal .wa-modal__close.wa-modal__close--float:active {
  transform: scale(0.96);
}

body.wa-modal-open,
html.wa-modal-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .wa-modal__panel {
    width: calc(100vw - 28px);
    max-height: 86vh;
  }

  .wa-modal--confirm .wa-modal__panel {
    width: calc(100vw - 28px);
    padding: 18px 16px 16px;
  }

  .wa-modal--wechat .wa-modal__panel {
    width: 100%;
    max-height: none;
  }

  .wa-modal__dialog {
    width: min(360px, calc(100vw - 28px));
  }

  .wa-modal__header {
    min-height: 48px;
    padding: 10px 14px;
  }

  .wa-modal__body {
    padding: 12px 14px 16px;
  }

  .wa-modal--confirm .wa-modal__body--confirm {
    padding-right: 24px;
    gap: 12px;
  }

  .wa-modal__footer {
    padding: 10px 14px 14px;
  }

  .wa-modal--confirm .wa-modal__footer {
    padding: 0;
    margin-top: 18px;
  }

  .wa-modal__body--wechat {
    padding: 28px 18px 32px;
  }

  .wa-modal__qr img {
    width: 180px;
    height: 180px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wa-modal.is-open .wa-modal__panel,
  .wa-modal.is-open .wa-modal__dialog,
  .wa-modal.is-open .wa-modal__overlay,
  .wa-toast,
  .wa-toast.is-leaving {
    animation: none !important;
  }
}
