/* ============================================================================
 * 本草智研 · 中药药学研究与小试—中试产业转化训练样式系统
 * 延续 Botanical Precision 视觉体系，完整适配浅色、深色护眼（dark-lab）及 A4 打印
 * ============================================================================ */

/* 路由显隐编排 */
body[data-v16-route="translation"] #qwenCommandBar,
body[data-v16-route="translation"] #aiPlanShowcase,
body[data-v16-route="translation"] .wpanel {
  display: none !important;
}

.tr-wrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 36px;
}

/* 顶部项目头与标杆切换区 */
.tr-hero {
  background: linear-gradient(135deg, #062b26 0%, #0b463e 56%, #0f5c54 100%);
  color: #f4faf7;
  border-radius: var(--ds-radius-xl, 24px);
  padding: 22px 24px;
  box-shadow: var(--ds-shadow-2);
  border: 1px solid rgba(52, 211, 153, 0.22);
  position: relative;
  overflow: hidden;
}
.tr-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.tr-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(110, 231, 183, 0.28);
  padding: 4px 11px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.tr-hero h2 {
  margin: 0;
  font-size: clamp(1.22rem, 2.2vw, 1.56rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: #ffffff;
}
.tr-hero-sub {
  margin: 7px 0 0;
  font-size: 0.84rem;
  line-height: 1.62;
  color: rgba(236, 253, 245, 0.84);
  max-width: 760px;
}
.tr-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.tr-btn-light {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #062b26;
  background: #f0fdf4;
  border: 1px solid rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: transform 0.18s var(--ds-ease), background 0.18s ease;
}
.tr-btn-light:hover { background: #ffffff; transform: translateY(-1px); }
.tr-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ecfdf5;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.tr-btn-ghost:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.4); }

/* 标杆项目切换条 + 题库导入 */
.tr-proj-bar {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.tr-proj-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: rgba(209, 250, 229, 0.8);
  margin-right: 4px;
}
.tr-proj-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 11px;
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(236, 253, 245, 0.9);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: all 0.18s ease;
}
.tr-proj-pill:hover { background: rgba(255, 255, 255, 0.16); }
.tr-proj-pill.active {
  background: #ffffff;
  color: #062b26;
  border-color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}
.tr-proj-pill .tr-pill-sub {
  font-size: 0.68rem;
  font-weight: 600;
  opacity: 0.75;
}
.tr-bank-select {
  margin-left: auto;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 0.77rem;
  font-weight: 600;
  color: #062b26;
  background: rgba(240, 253, 244, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.45);
  max-width: 245px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 法规与数据可信度状态带 */
.tr-trust-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 15px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line-strong);
  box-shadow: var(--ds-shadow-1);
  font-size: 0.77rem;
  color: var(--ds-ink-2);
}
.tr-trust-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.tr-trust-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* 来源徽章（强制可信度分层标注） */
.tr-src {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.69rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  vertical-align: middle;
}
.tr-src-pharm { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.tr-src-reg { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.tr-src-lit { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }
.tr-src-calc { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.tr-src-example { background: #f8fafc; color: #475569; border: 1px solid #cbd5e1; }
.tr-src-user { background: #f0fdfa; color: #0f766e; border: 1px solid #5eead4; }
.tr-src-ai { background: #fdf2f8; color: #be185d; border: 1px solid #fbcfe8; }

/* 八阶段主线导航条 */
.tr-stepper {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 18px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  box-shadow: var(--ds-shadow-1);
}
@media (max-width: 1080px) {
  .tr-stepper { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .tr-stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.tr-step-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 9px 11px;
  border-radius: 13px;
  background: var(--ds-surface-soft);
  border: 1px solid transparent;
  color: var(--ds-ink-2);
  text-align: left;
  cursor: pointer;
  transition: all 0.18s var(--ds-ease);
}
.tr-step-btn:hover {
  border-color: var(--ds-line-strong);
  transform: translateY(-1px);
}
.tr-step-btn.active {
  background: var(--ds-primary);
  color: #ffffff;
  border-color: var(--ds-primary);
  box-shadow: 0 8px 20px -8px rgba(7, 47, 41, 0.45);
}
.tr-step-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 800;
  opacity: 0.75;
}
.tr-step-name {
  font-size: 0.83rem;
  font-weight: 800;
  line-height: 1.25;
}
.tr-step-out {
  font-size: 0.68rem;
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* 通用面板卡片 */
.tr-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-lg, 18px);
  padding: 20px 22px;
  box-shadow: var(--ds-shadow-1);
}
.tr-card-soft {
  background: var(--ds-surface-soft);
  border: 1px solid var(--ds-line);
  border-radius: 15px;
  padding: 15px 16px;
}
.tr-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.tr-card-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--ds-ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tr-card-desc {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--ds-muted);
  line-height: 1.55;
}

/* 网格布局 */
.tr-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.tr-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.tr-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.tr-split-64 {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 16px;
}
@media (max-width: 980px) {
  .tr-grid-2, .tr-grid-3, .tr-grid-4, .tr-split-64 { grid-template-columns: 1fr; }
}

/* 表单控件 */
.tr-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.tr-field label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ds-ink-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.tr-input, .tr-select, .tr-textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid var(--ds-line-strong);
  background: var(--ds-surface);
  color: var(--ds-ink);
  font-size: 0.82rem;
  line-height: 1.45;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tr-input:focus, .tr-select:focus, .tr-textarea:focus {
  outline: none;
  border-color: var(--ds-primary-2);
  box-shadow: 0 0 0 3px rgba(15, 92, 84, 0.12);
}
.tr-range {
  width: 100%;
  accent-color: #0f5c54;
  cursor: pointer;
}

/* 按钮 */
.tr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 11px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--ds-line-strong);
  background: var(--ds-surface);
  color: var(--ds-ink);
  transition: all 0.16s ease;
}
.tr-btn:hover { border-color: var(--ds-primary-2); color: var(--ds-primary-2); }
.tr-btn-primary {
  background: var(--ds-primary);
  color: #ffffff;
  border-color: var(--ds-primary);
}
.tr-btn-primary:hover { background: var(--ds-primary-2); color: #ffffff; }
.tr-btn-sm { padding: 5px 10px; font-size: 0.75rem; border-radius: 9px; }
.tr-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.tr-chip {
  padding: 6px 11px;
  border-radius: 10px;
  font-size: 0.77rem;
  font-weight: 700;
  border: 1px solid var(--ds-line-strong);
  background: var(--ds-surface-soft);
  color: var(--ds-ink-2);
  cursor: pointer;
  transition: all 0.16s ease;
}
.tr-chip:hover { border-color: var(--ds-primary-2); }
.tr-chip.active {
  background: var(--ds-primary);
  color: #ffffff;
  border-color: var(--ds-primary);
}

/* KPI 指标块 */
.tr-kpi {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--ds-surface-soft);
  border: 1px solid var(--ds-line);
}
.tr-kpi-label { font-size: 0.73rem; color: var(--ds-muted); font-weight: 600; }
.tr-kpi-val { font-size: 1.24rem; font-weight: 800; color: var(--ds-ink); margin-top: 3px; line-height: 1.2; }
.tr-kpi-note { font-size: 0.71rem; color: var(--ds-muted); margin-top: 4px; }

/* 表格 */
.tr-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--ds-line); }
.tr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.tr-table th, .tr-table td {
  padding: 9px 11px;
  text-align: left;
  border-bottom: 1px solid var(--ds-line);
  vertical-align: top;
  color: var(--ds-ink);
}
.tr-table th {
  background: var(--ds-surface-soft);
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--ds-ink-2);
  white-space: nowrap;
}
.tr-table tr:last-child td { border-bottom: none; }
.tr-table input[type="number"] {
  width: 74px;
  padding: 4px 6px;
  border-radius: 7px;
  border: 1px solid var(--ds-line-strong);
  background: var(--ds-surface);
  color: var(--ds-ink);
  font-size: 0.79rem;
  font-weight: 700;
}

/* 提示框 */
.tr-alert {
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 0.79rem;
  line-height: 1.6;
  border: 1px solid rgba(201, 146, 44, 0.35);
  background: rgba(254, 243, 199, 0.45);
  color: #78350f;
}
.tr-alert-ok {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(209, 250, 229, 0.45);
  color: #065f46;
}
.tr-alert-warn {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(254, 226, 226, 0.5);
  color: #991b1b;
}

/* 进度与条形图 */
.tr-bar-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: rgba(15, 92, 84, 0.10);
  overflow: hidden;
}
.tr-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0f5c54, #10b981);
  transition: width 0.28s var(--ds-ease);
}

/* 路径选择卡片 */
.tr-path-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 980px) { .tr-path-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .tr-path-grid { grid-template-columns: 1fr; } }
.tr-path-card {
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid var(--ds-line);
  background: var(--ds-surface-soft);
  text-align: left;
  cursor: pointer;
  transition: all 0.16s ease;
}
.tr-path-card:hover { border-color: var(--ds-primary-2); transform: translateY(-1px); }
.tr-path-card.active {
  background: linear-gradient(180deg, rgba(15, 92, 84, 0.08), rgba(16, 185, 129, 0.04));
  border-color: var(--ds-primary-2);
  box-shadow: 0 0 0 2px rgba(15, 92, 84, 0.16);
}
.tr-path-cat { font-size: 0.69rem; font-weight: 700; color: var(--ds-primary-2); }
.tr-path-name { font-size: 0.88rem; font-weight: 800; color: var(--ds-ink); margin-top: 2px; }
.tr-path-fit { font-size: 0.73rem; color: var(--ds-muted); margin-top: 4px; line-height: 1.45; }

/* 子标签切换 */
.tr-subtabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--ds-surface-soft);
  border: 1px solid var(--ds-line);
}
.tr-subtab {
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ds-muted);
  background: transparent;
  border: none;
  cursor: pointer;
}
.tr-subtab.active {
  background: var(--ds-surface);
  color: var(--ds-ink);
  box-shadow: var(--ds-shadow-1);
}

/* 流程节点链 */
.tr-flow-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.tr-flow-node {
  padding: 6px 11px;
  border-radius: 10px;
  background: var(--ds-surface-soft);
  border: 1px solid var(--ds-line-strong);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ds-ink);
}
.tr-flow-arrow { color: var(--ds-muted); font-weight: 800; font-size: 0.8rem; }

/* 底部上一阶段 / 下一阶段导航 */
.tr-stage-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
}

/* 报告弹窗（A4 规范药学研究与小试转化报告） */
.tr-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(4, 24, 21, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.tr-modal-mask.hidden { display: none !important; }
.tr-modal-shell {
  width: min(980px, 100%);
  max-height: 90vh;
  background: var(--ds-surface);
  border-radius: 20px;
  border: 1px solid var(--ds-line-strong);
  box-shadow: var(--ds-shadow-3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tr-modal-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--ds-line);
  background: var(--ds-surface-soft);
}
.tr-modal-body {
  overflow-y: auto;
  padding: 22px 26px;
  color: #1e293b;
  background: #ffffff;
}
.tr-report-sheet h1 { font-size: 1.32rem; font-weight: 800; color: #062b26; margin: 0 0 6px; }
.tr-report-sheet h3 { font-size: 0.96rem; font-weight: 800; color: #0b463e; margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 1.5px solid #d1fae5; }
.tr-report-sheet p, .tr-report-sheet li { font-size: 0.82rem; line-height: 1.65; color: #334155; }
.tr-report-sheet table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 0.78rem; }
.tr-report-sheet th, .tr-report-sheet td { border: 1px solid #cbd5e1; padding: 6px 8px; text-align: left; }
.tr-report-sheet th { background: #f1f5f9; font-weight: 700; color: #0f172a; }

/* 首页 4 列工作方式网格适配 */
.v16-branch-grid.tr-cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1120px) {
  .v16-branch-grid.tr-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .v16-branch-grid.tr-cols-4 { grid-template-columns: 1fr; }
}

/* 深色护眼模式适配 */
body.dark-lab .tr-src-pharm { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.35); }
body.dark-lab .tr-src-reg { background: rgba(59, 130, 246, 0.18); color: #93c5fd; border-color: rgba(96, 165, 250, 0.35); }
body.dark-lab .tr-src-lit { background: rgba(139, 92, 246, 0.18); color: #c4b5fd; border-color: rgba(167, 139, 250, 0.35); }
body.dark-lab .tr-src-calc { background: rgba(245, 158, 11, 0.18); color: #fcd34d; border-color: rgba(251, 191, 36, 0.35); }
body.dark-lab .tr-src-example { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.35); }
body.dark-lab .tr-src-user { background: rgba(20, 184, 166, 0.18); color: #5eead4; border-color: rgba(45, 212, 191, 0.35); }
body.dark-lab .tr-src-ai { background: rgba(236, 72, 153, 0.18); color: #f9a8d4; border-color: rgba(244, 114, 182, 0.35); }

body.dark-lab .tr-alert { background: rgba(180, 83, 9, 0.18); border-color: rgba(251, 191, 36, 0.35); color: #fde68a; }
body.dark-lab .tr-alert-ok { background: rgba(6, 95, 70, 0.28); border-color: rgba(52, 211, 153, 0.35); color: #a7f3d0; }
body.dark-lab .tr-alert-warn { background: rgba(153, 27, 27, 0.28); border-color: rgba(248, 113, 113, 0.4); color: #fecaca; }
body.dark-lab .tr-step-btn.active { background: #10b981; color: #04211c; border-color: #10b981; }
body.dark-lab .tr-chip.active { background: #10b981; color: #04211c; border-color: #10b981; }
body.dark-lab .tr-btn-primary { background: #10b981; color: #04211c; border-color: #10b981; }
body.dark-lab .tr-btn-primary:hover { background: #34d399; color: #04211c; }
body.dark-lab .tr-btn-light {
  background: #10b981 !important;
  color: #04211c !important;
  border-color: #34d399 !important;
}
body.dark-lab .tr-btn-light:hover {
  background: #34d399 !important;
  color: #04211c !important;
}
body.dark-lab .tr-proj-pill.active {
  background: #10b981 !important;
  color: #04211c !important;
  border-color: #34d399 !important;
}
body.dark-lab .tr-bank-select {
  background: #0d2621 !important;
  color: #e6f4ef !important;
  border-color: rgba(52, 211, 153, 0.38) !important;
}

@media print {
  body.tr-printing-report > *:not(#trReportModal) { display: none !important; }
  body.tr-printing-report #trReportModal {
    position: static !important;
    background: #ffffff !important;
    padding: 0 !important;
    display: block !important;
  }
  body.tr-printing-report .tr-modal-shell {
    max-height: none !important;
    width: 100% !important;
    border: none !important;
    box-shadow: none !important;
  }
  body.tr-printing-report .tr-modal-bar { display: none !important; }
  body.tr-printing-report .tr-modal-body { overflow: visible !important; padding: 0 !important; }
}
