/* =============================================================================
   Paper 论文智导 — 基础组件层（2026-10-23 改版 v2）
   依赖 shared/tokens.css；只作用于 <body class="ui2">
   ========================================================================== */

/* ── 按钮 ─────────────────────────────────────────────────────────────── */
body.ui2 .p-btn,
body.ui2 .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px;
  border-radius: var(--p-r-btn); border: 1px solid transparent;
  font-family: var(--p-font-sans); font-size: 15px; font-weight: 600; line-height: 1;
  background: var(--p-primary); color: #fff;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .18s ease, box-shadow .18s ease, transform .12s ease, border-color .18s ease;
}
body.ui2 .p-btn:hover, body.ui2 .btn:hover { background: var(--p-primary-hover); box-shadow: var(--p-shadow-md); }
body.ui2 .p-btn:active, body.ui2 .btn:active { background: var(--p-primary-active); transform: translateY(1px); }
body.ui2 .p-btn[disabled], body.ui2 .btn[disabled],
body.ui2 .p-btn.is-disabled, body.ui2 .btn.is-disabled {
  background: #C7D2F4; color: #fff; cursor: not-allowed; box-shadow: none; transform: none;
}
body.ui2 .p-btn--lg, body.ui2 .btn--lg { height: 52px; font-size: 16px; padding: 0 28px; }
body.ui2 .p-btn--sm, body.ui2 .btn--sm { height: 36px; font-size: 14px; padding: 0 16px; }
body.ui2 .p-btn--hero { height: 52px; width: 100%; font-size: 16px; }

body.ui2 .p-btn--secondary,
body.ui2 .btn-outline {
  background: #fff; color: var(--p-text-1); border-color: var(--p-border);
  box-shadow: none;
}
body.ui2 .p-btn--secondary:hover,
body.ui2 .btn-outline:hover { background: var(--p-bg-subtle); border-color: #C7D2F4; color: var(--p-text-1); }

body.ui2 .p-btn--ghost {
  background: transparent; color: var(--p-primary); padding: 0 4px; height: auto; box-shadow: none;
}
body.ui2 .p-btn--ghost:hover { background: transparent; text-decoration: underline; box-shadow: none; }
body.ui2 .p-btn--ghost::after { content: "→"; }

body.ui2 .p-btn.is-loading { pointer-events: none; opacity: .85; }
body.ui2 .p-btn.is-loading::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45); border-top-color: #fff;
  animation: p-spin .8s linear infinite;
}
@keyframes p-spin { to { transform: rotate(360deg); } }

/* ── 输入框 / 文本域 ──────────────────────────────────────────────────── */
body.ui2 .p-input,
body.ui2 .p-textarea {
  width: 100%; font-family: var(--p-font-sans); font-size: var(--p-fs-body);
  color: var(--p-text-1); background: #fff;
  border: 1px solid var(--p-border); border-radius: var(--p-r-input);
  padding: 0 14px; height: 44px; line-height: 42px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
body.ui2 .p-input::placeholder,
body.ui2 .p-textarea::placeholder { color: var(--p-placeholder); }
body.ui2 .p-input:focus,
body.ui2 .p-textarea:focus {
  outline: none; border-color: var(--p-primary); box-shadow: 0 0 0 3px var(--p-primary-tint);
}
body.ui2 .p-textarea { min-height: 120px; padding: 12px 14px; line-height: 1.65; resize: vertical; }
body.ui2 .p-field { margin-bottom: var(--p-s4); }
body.ui2 .p-field > label { display: block; font-size: var(--p-fs-small); font-weight: 600; color: var(--p-text-1); margin-bottom: 6px; }
body.ui2 .p-field .p-hint { font-size: var(--p-fs-small); color: var(--p-text-3); margin-top: 6px; }
body.ui2 .p-field.has-error .p-input { border-color: var(--p-danger); }
body.ui2 .p-field .p-error { color: var(--p-danger); font-size: var(--p-fs-small); margin-top: 6px; }
body.ui2 .p-counter { font-size: var(--p-fs-caption); color: var(--p-text-3); text-align: right; margin-top: 4px; }

/* ── 工具卡内嵌表单（首页 17 张工具卡，2026-10-23 缺陷#1 恢复可见后补样式）── */
body.ui2 .hx-tool-embed {
  order: 3;
  display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start;
  margin-top: 2px; padding-top: 14px;
  border-top: 1px solid var(--p-divider);
}
body.ui2 .hx-tool-foot { order: 4; }
/* 文本控件/下拉/按钮/结果区独占整行；单选组（第 08 卡）并排成胶囊 */
body.ui2 .hx-tool-embed > textarea,
body.ui2 .hx-tool-embed > input:not([type="radio"]):not([type="checkbox"]),
body.ui2 .hx-tool-embed > select,
body.ui2 .hx-tool-embed > button,
body.ui2 .hx-tool-embed > .tool-result,
body.ui2 .hx-tool-embed > .tool-limit { flex: 0 0 100%; }
body.ui2 .hx-tool-embed > label {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 9px;
  font-size: 12.5px; line-height: 18px; color: var(--p-text-2);
  background: #fff; border: 1px solid var(--p-border); border-radius: var(--p-r-pill);
  cursor: pointer; transition: border-color .18s ease, background .18s ease, color .18s ease;
}
body.ui2 .hx-tool-embed > label:hover { border-color: #C7D2F4; }
body.ui2 .hx-tool-embed > label:has(input:checked) {
  border-color: var(--p-primary); background: var(--p-primary-tint); color: var(--p-primary); font-weight: 600;
}
body.ui2 .hx-tool-embed label input[type="radio"] {
  width: 13px; height: 13px; margin: 0; padding: 0; flex: none;
  accent-color: var(--p-primary); box-shadow: none;
}
body.ui2 .hx-tool-embed textarea,
body.ui2 .hx-tool-embed input:not([type="radio"]):not([type="checkbox"]) {
  width: 100%; box-sizing: border-box;
  font-family: var(--p-font-sans); font-size: 13px; line-height: 1.6; color: var(--p-text-1);
  background: #fff; border: 1px solid var(--p-border); border-radius: var(--p-r-input);
  padding: 9px 11px; outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
body.ui2 .hx-tool-embed input:not([type="radio"]):not([type="checkbox"]) { height: 38px; padding: 0 11px; }
body.ui2 .hx-tool-embed textarea { min-height: 78px; resize: vertical; }
body.ui2 .hx-tool-embed textarea + textarea { min-height: 62px; }
body.ui2 .hx-tool-embed textarea::placeholder,
body.ui2 .hx-tool-embed input:not([type="radio"]):not([type="checkbox"])::placeholder { color: var(--p-placeholder); }
body.ui2 .hx-tool-embed textarea:focus,
body.ui2 .hx-tool-embed input:not([type="radio"]):not([type="checkbox"]):focus,
body.ui2 .hx-tool-embed select:focus {
  border-color: var(--p-primary); box-shadow: 0 0 0 3px var(--p-primary-tint);
}
body.ui2 .hx-tool-embed select {
  width: 100%; box-sizing: border-box; height: 38px; padding: 0 32px 0 11px;
  font-family: var(--p-font-sans); font-size: 13px; color: var(--p-text-1);
  background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667085' d='M6 8.2 1.8 4h8.4z'/%3E%3C/svg%3E") no-repeat right 11px center;
  border: 1px solid var(--p-border); border-radius: var(--p-r-input);
  outline: none; -webkit-appearance: none; appearance: none; cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease;
}
body.ui2 .hx-tool-embed button {
  width: 100%; height: 40px; padding: 0; border: 0; border-radius: var(--p-r-input);
  font-family: var(--p-font-sans); font-size: 13.5px; font-weight: 600;
  color: #fff; background: var(--p-primary); cursor: pointer;
  transition: background .18s ease, opacity .18s ease;
}
body.ui2 .hx-tool-embed button:hover { background: var(--p-primary-hover); }
body.ui2 .hx-tool-embed button:active { background: var(--p-primary-active); }
body.ui2 .hx-tool-embed button:disabled { opacity: .55; cursor: not-allowed; }
/* 单价每张卡只出现一次，且不重复：
   12 张写作卡 → 由 scripts-v8.js 写入的服务端价（.tool-limit）承担，脚注徽标隐藏；
   5 张文献卡 → 价已写死在 .tool-limit[data-fixed] 且含 ¥ 信息，脚注徽标隐藏。 */
body.ui2 .hx-tool-embed .tool-limit:not([data-fixed]) { display: none; }
body.ui2 .hx-tool:has(.tool-limit[data-fixed]) .hx-tool-foot .p-badge { display: none; }
body.ui2 .hx-tool-embed .tool-limit[data-fixed] {
  font-size: var(--p-fs-caption); line-height: 18px; color: var(--p-text-3);
}
body.ui2 .hx-tool-embed .tool-result {
  margin-top: 0; padding: 10px 12px;
  background: var(--p-bg-subtle); border: 1px solid var(--p-border); border-radius: var(--p-r-input);
  font-size: 12.5px; line-height: 1.8; color: var(--p-text-2); text-align: left; word-break: break-word;
}
/* 结果区里的登录/充值引导：收成小胶囊，别在卡内堆三个大按钮 */
body.ui2 .hx-tool-embed .tool-result .tr-cta { text-align: center; color: var(--p-text-2); }
body.ui2 .hx-tool-embed .tool-result .tr-cta strong { display: block; margin-bottom: 4px; font-size: 12.5px; color: var(--p-text-1); }
body.ui2 .hx-tool-embed .tool-result .tr-cta strong + br { display: none; }
body.ui2 .hx-tool-embed .tool-result .tr-cta a {
  display: inline-block; margin: 4px 3px 0; padding: 4px 10px;
  border: 1px solid var(--p-primary); border-radius: var(--p-r-pill);
  background: var(--p-primary-tint); color: var(--p-primary);
  font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
body.ui2 .hx-tool-embed .tool-result .tr-cta a:hover { background: #E3EBFF; text-decoration: none; }

/* ── 卡片 ─────────────────────────────────────────────────────────────── */
body.ui2 .p-card {
  background: #fff; border: 1px solid var(--p-border); border-radius: var(--p-r-card);
  padding: var(--p-s5); box-shadow: var(--p-shadow-sm);
}
body.ui2 .p-card--clickable { cursor: pointer; transition: box-shadow .18s ease, border-color .18s ease; }
body.ui2 .p-card--clickable:hover { box-shadow: var(--p-shadow-md); border-color: #C7D2F4; }

/* ── 徽章 ─────────────────────────────────────────────────────────────── */
body.ui2 .p-badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: var(--p-r-pill); font-size: var(--p-fs-caption); font-weight: 500; line-height: 1;
  background: var(--p-bg-subtle); color: var(--p-text-2); white-space: nowrap;
}
body.ui2 .p-badge--success { background: var(--p-success-tint); color: var(--p-success); }
body.ui2 .p-badge--warn { background: var(--p-warning-tint); color: var(--p-warning); }
body.ui2 .p-badge--recommend { background: var(--p-accent-gold); color: #fff; }
body.ui2 .p-badge--info { background: var(--p-primary-tint); color: var(--p-primary); }

/* ── 信息条 ───────────────────────────────────────────────────────────── */
body.ui2 .p-info-bar {
  position: relative; border-radius: 8px; padding: 12px 16px 12px 18px;
  background: var(--p-primary-tint); color: var(--p-text-1);
  font-size: var(--p-fs-small); line-height: 1.7;
}
body.ui2 .p-info-bar::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 3px; background: var(--p-primary);
}
body.ui2 .p-info-bar--warn { background: var(--p-warning-tint); }
body.ui2 .p-info-bar--warn::before { background: var(--p-warning); }
body.ui2 .p-info-bar--success { background: var(--p-success-tint); }
body.ui2 .p-info-bar--success::before { background: var(--p-success); }
body.ui2 .p-info-bar b { font-weight: 600; }

/* ── 弹窗 ─────────────────────────────────────────────────────────────── */
body.ui2 .p-modal-mask {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(15, 23, 42, .55);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
body.ui2 .p-modal-mask.is-open { display: flex; }
body.ui2 .p-modal {
  width: 480px; max-width: 100%; max-height: calc(100vh - 48px); overflow: auto;
  background: #fff; border-radius: var(--p-r-modal); padding: 32px;
  box-shadow: var(--p-shadow-lg); position: relative;
}
body.ui2 .p-modal--wide { width: 600px; }
body.ui2 .p-modal h3 { margin: 0 0 var(--p-s3); font-size: 22px; line-height: 30px; color: var(--p-brand-navy); font-weight: 700; }
body.ui2 .p-modal .p-modal-sub { margin: 0 0 var(--p-s5); font-size: var(--p-fs-small); color: var(--p-text-2); }
body.ui2 .p-modal-close {
  position: absolute; top: 16px; right: 16px; width: 32px; height: 32px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: var(--p-text-3); font-size: 18px; line-height: 1; background: transparent;
}
body.ui2 .p-modal-close:hover { background: var(--p-bg-subtle); color: var(--p-text-1); }

/* ── 骨架屏 / Toast ───────────────────────────────────────────────────── */
body.ui2 .p-skeleton {
  background: var(--p-bg-subtle); border-radius: 8px; height: 16px;
  animation: p-breath 1.2s ease-in-out infinite;
}
@keyframes p-breath { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

body.ui2 .p-toast {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%);
  z-index: 9200; background: #101828; color: #fff;
  border-radius: 10px; padding: 10px 18px; font-size: var(--p-fs-small);
  box-shadow: var(--p-shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
body.ui2 .p-toast.is-open { opacity: 1; transform: translateX(-50%) translateY(2px); }

/* ── 分段切换 ─────────────────────────────────────────────────────────── */
body.ui2 .p-segmented {
  display: inline-flex; background: var(--p-bg-subtle); border-radius: var(--p-r-pill); padding: 4px; gap: 4px;
}
body.ui2 .p-segmented button {
  height: 28px; padding: 0 16px; border-radius: var(--p-r-pill);
  font-size: var(--p-fs-small); font-weight: 500; color: var(--p-text-2); background: transparent;
}
body.ui2 .p-segmented button.is-active { background: #fff; color: var(--p-brand-navy); font-weight: 600; box-shadow: var(--p-shadow-sm); }

/* ── 价格卡（价格页与首页价格区共用） ─────────────────────────────────── */
body.ui2 .p-plan-grid { display: flex; gap: 24px; justify-content: center; align-items: flex-start; flex-wrap: wrap; }
body.ui2 .p-plan {
  width: 400px; max-width: 100%; background: #fff; border: 1px solid var(--p-border);
  border-radius: var(--p-r-card); padding: var(--p-s6); box-shadow: var(--p-shadow-sm); position: relative;
}
body.ui2 .p-plan--featured { border: 2px solid #1F4FD8; box-shadow: var(--p-shadow-md); transform: scale(1.04); }
body.ui2 .p-plan--featured::before {
  content: "期刊 / 硕博推荐"; position: absolute; left: 0; right: 0; top: 0;
  height: 34px; display: flex; align-items: center; justify-content: center;
  background: var(--p-gold-tint); color: var(--p-accent-gold);
  font-size: var(--p-fs-caption); font-weight: 600; letter-spacing: .04em;
  border-radius: var(--p-r-card) var(--p-r-card) 0 0;
}
body.ui2 .p-plan--featured { padding-top: calc(var(--p-s6) + 26px); }
body.ui2 .p-plan-name { font-size: 15px; font-weight: 600; color: var(--p-text-2); }
body.ui2 .p-plan-price { font-family: var(--p-font-num); font-size: var(--p-fs-price); line-height: var(--p-lh-price); font-weight: 700; color: var(--p-brand-navy); font-variant-numeric: tabular-nums; }
body.ui2 .p-plan-price small { font-size: 16px; font-weight: 600; color: var(--p-text-3); margin-left: 4px; }
body.ui2 .p-plan-credits { font-size: 15px; color: var(--p-text-1); font-weight: 600; margin-top: 4px; }
body.ui2 .p-plan-unit { font-size: var(--p-fs-small); color: var(--p-text-3); margin-top: 2px; }
body.ui2 .p-plan-diff { font-size: var(--p-fs-small); color: var(--p-success); margin-top: 6px; }
body.ui2 .p-plan-for { font-size: var(--p-fs-small); color: var(--p-text-2); line-height: 1.7; margin: 12px 0 0; }
body.ui2 .p-plan-list { list-style: none; margin: 14px 0 0; padding: 0; font-size: var(--p-fs-small); color: var(--p-text-2); }
body.ui2 .p-plan-list li { position: relative; padding-left: 20px; line-height: 1.9; }
body.ui2 .p-plan-list li::before { content: "✓"; position: absolute; left: 0; color: var(--p-success); font-weight: 700; }
body.ui2 .p-plan .p-btn { width: 100%; margin-top: var(--p-s5); }

/* ── 横排特性条 ───────────────────────────────────────────────────────── */
body.ui2 .p-assure-row {
  display: flex; flex-wrap: wrap; gap: 12px 32px; justify-content: center;
  font-size: var(--p-fs-small); color: var(--p-text-2);
}
body.ui2 .p-assure-row span::before { content: "✓"; color: var(--p-success); margin-right: 6px; font-weight: 700; }

/* 移动端回归：不横向滚动 */
@media (max-width: 640px) {
  body.ui2 .p-modal { padding: 24px; }
  body.ui2 .p-plan--featured { transform: none; }
  body.ui2 .p-container { padding: 0 16px; }
}

/* ── 付费弹窗（选档）P0-2 ─────────────────────────────────────────────── */
body.ui2 .pw-modal { padding-top: 28px; }
body.ui2 .pw-plans { display: flex; gap: 12px; margin: 16px 0 14px; }
body.ui2 .pw-plan {
  flex: 1; border: 1px solid var(--p-border); border-radius: 12px; padding: 14px 16px;
  cursor: pointer; background: #fff; transition: border-color .16s ease, background .16s ease;
}
body.ui2 .pw-plan:hover { border-color: #C7D2F4; }
body.ui2 .pw-plan.is-selected { border: 2px solid var(--p-primary); background: var(--p-primary-tint); }
body.ui2 .pw-plan-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
body.ui2 .pw-plan-name { font-size: 14px; font-weight: 600; color: var(--p-brand-navy); }
body.ui2 .pw-plan-price { font-family: var(--p-font-num); font-size: 30px; line-height: 36px; font-weight: 700; color: var(--p-brand-navy); font-variant-numeric: tabular-nums; }
body.ui2 .pw-plan-credits { font-size: 14px; font-weight: 600; color: var(--p-text-1); margin-top: 2px; }
body.ui2 .pw-plan-unit { font-size: 12px; color: var(--p-text-3); margin-top: 2px; }
body.ui2 .pw-plan-diff { font-size: 12px; color: var(--p-success); margin-top: 4px; }
body.ui2 .pw-reason { margin-bottom: 14px; }
body.ui2 .pw-pay { margin-top: 4px; }
body.ui2 .pw-notes { font-size: 13px; color: var(--p-text-3); text-align: center; margin-top: 10px; line-height: 1.7; }
body.ui2 .pw-sample { display: block; text-align: center; margin-top: 12px; }
body.ui2 .pw-fine { font-size: 12px; color: var(--p-text-3); text-align: center; margin-top: 8px; }
@media (max-width: 640px) {
  body.ui2 .pw-plans { flex-direction: column; }
}
/* 价格卡等高对齐（2026-10-23 修） */
body.ui2 .p-plan-grid { align-items: stretch; }
body.ui2 .p-plan { display: flex; flex-direction: column; }
body.ui2 .p-plan .p-btn { margin-top: auto; }
body.ui2 .p-plan-list { margin-bottom: var(--p-s5); }
