/* appeal-view.css — 用户端申诉闭环样式
   复用 assets/styles.css 变量体系 */

/* ── 申诉列表 ── */
.ap-list-table { min-width: 1200px; }
.ap-list-table tbody tr { cursor: pointer; transition: background .1s; }
.ap-list-table tbody tr:hover { background: var(--surface-soft); }
.ap-list-table tbody tr.selected { background: var(--brand-soft); }
.ap-trace-id { font-family: ui-monospace, monospace; font-size: 11px; font-weight: 700; }
.ap-meta { font-size: 10px; color: var(--subtle); margin-top: 2px; }

/* 申诉状态徽标 */
.ap-status-badge {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 750;
  padding: 2px 8px; border-radius: 5px; white-space: nowrap;
}
.ap-status-badge.pending { background: var(--amber-soft); color: #b45309; }
.ap-status-badge.reviewing { background: #dbeafe; color: #1e40af; }
.ap-status-badge.upheld { background: var(--red-soft); color: var(--red); }
.ap-status-badge.resolved { background: var(--green-soft); color: var(--green); }
/* —— 6 态新增徽标（B 分片）—— */
.ap-status-badge.first_review { background: #dbeafe; color: #1e40af; }
.ap-status-badge.awaiting_final { background: #ede9fe; color: #6d28d9; }
.ap-status-badge.cancel { background: var(--surface-soft); color: var(--muted); }
/* tone 兜底（STATUS_MAP.tone → class，避免无对应状态名时无配色） */
.ap-status-badge.ap-tone-warn { background: var(--amber-soft); color: #b45309; }
.ap-status-badge.ap-tone-info { background: #dbeafe; color: #1e40af; }
.ap-status-badge.ap-tone-good { background: var(--green-soft); color: var(--green); }
.ap-status-badge.ap-tone-bad { background: var(--red-soft); color: var(--red); }
.ap-status-badge.ap-tone-neutral { background: var(--surface-soft); color: var(--muted); }

/* 申诉类型徽标 */
.ap-type-badge {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px; white-space: nowrap;
}
.ap-type-badge.post_review_violation { background: #fef3c7; color: #92400e; }
.ap-type-badge.pre_review_rejection { background: #eff6ff; color: #1e40af; }

/* 规则类别徽标 */
.ap-rule-cat-badge {
  display: inline-flex; align-items: center; font-size: 9px; font-weight: 700;
  padding: 1px 6px; border-radius: 3px; white-space: nowrap;
}
.ap-rule-cat-badge.high { background: var(--red-soft); color: var(--red); }
.ap-rule-cat-badge.medium { background: #fef3c7; color: #92400e; }
.ap-rule-cat-badge.low { background: var(--surface-soft); color: var(--muted); }

/* ── 申诉详情时间线 ── */
.ap-timeline {
  border: 1px solid var(--line); border-radius: 8px; padding: 12px;
  background: var(--surface); display: grid; gap: 0;
}
.ap-timeline .tl-head { font-size: 12px; font-weight: 800; margin-bottom: 8px; }
.ap-tl-item {
  display: grid; grid-template-columns: 24px 1fr auto; gap: 8px;
  padding: 6px 0; position: relative; align-items: start;
}
.ap-tl-item:not(:last-child)::before {
  content: ''; position: absolute; left: 11px; top: 24px; bottom: -2px;
  width: 2px; background: var(--line);
}
.ap-tl-dot {
  width: 18px; height: 18px; border-radius: 50%; background: var(--surface-soft);
  border: 2px solid var(--line-strong); display: grid; place-items: center;
  font-size: 8px; font-weight: 800; color: var(--subtle); z-index: 1;
}
.ap-tl-item.op-user .ap-tl-dot { background: #6366f1; border-color: #6366f1; color: #fff; }
.ap-tl-item.op-system .ap-tl-dot { background: var(--surface-soft); border-color: var(--line); }
.ap-tl-item.op-reviewer .ap-tl-dot { background: #d97706; border-color: #d97706; color: #fff; }
.ap-tl-body { display: grid; gap: 1px; min-width: 0; }
.ap-tl-title { font-size: 11px; font-weight: 750; }
.ap-tl-detail { font-size: 10px; color: var(--muted); line-height: 1.4; }
.ap-tl-side { text-align: right; display: grid; gap: 1px; }
.ap-tl-time { font-size: 10px; color: var(--subtle); font-family: ui-monospace, monospace; }
.ap-tl-operator { font-size: 9px; color: var(--muted); }
.ap-tl-operator.op-user { color: #6366f1; font-weight: 700; }
.ap-tl-operator.op-reviewer { color: #92400e; font-weight: 700; }

/* ── 申诉提交抽屉 ── */
.ap-submit-form { display: grid; gap: 12px; }
.ap-form-group { display: grid; gap: 4px; }
.ap-form-group label { font-size: 11px; font-weight: 700; color: var(--muted); }
.ap-form-group label .required { color: var(--red); }
.ap-form-group textarea,
.ap-form-group input {
  font-size: 12px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; color: var(--text); width: 100%;
  font-family: inherit;
}
.ap-form-group textarea { min-height: 80px; resize: vertical; }
.ap-form-hint { font-size: 10px; color: var(--subtle); }
.ap-form-error { font-size: 10px; color: var(--red); font-weight: 700; }

/* 申诉规则提示卡 */
.ap-rules-card {
  padding: 10px 12px; background: #f0f9ff; border: 1px solid #bae6fd;
  border-radius: 6px; font-size: 10px; color: #0c4a6e; line-height: 1.7;
}
.ap-rules-card strong { color: #075985; }

/* ── 资产隔离态（appeal-console.js 增强 assets.html 用） ── */
.ap-asset-isolated {
  position: relative;
}
.ap-asset-isolated .ap-isolate-overlay {
  position: absolute; inset: 0; background: rgba(220, 38, 38, 0.15);
  backdrop-filter: blur(2px); display: grid; place-items: center;
  z-index: 5; border-radius: inherit; pointer-events: none;
}
.ap-asset-isolated .ap-isolate-badge {
  background: var(--red); color: #fff; font-size: 10px; font-weight: 800;
  padding: 4px 10px; border-radius: 4px; display: inline-flex; align-items: center; gap: 4px;
}
.ap-asset-isolated .ap-isolate-reason {
  font-size: 9px; color: #fff; margin-top: 4px; text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.ap-asset-isolated button[disabled],
.ap-asset-isolated .btn[disabled] {
  opacity: .4; cursor: not-allowed;
}

/* 资产详情中的申诉入口 */
.ap-detail-appeal-section {
  margin-top: 10px; padding: 10px 12px; background: #fef2f2;
  border: 1px solid #fecaca; border-radius: 6px; display: grid; gap: 8px;
}
.ap-detail-appeal-section .ap-appeal-title {
  font-size: 11px; font-weight: 800; color: #991b1b;
  display: flex; align-items: center; gap: 6px;
}
.ap-detail-appeal-section .ap-appeal-rule {
  font-size: 10px; color: #991b1b; line-height: 1.5;
}
.ap-detail-appeal-section .ap-appeal-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
}

/* ── 使用记录审核态（appeal-console.js 增强 usage.html 用） ── */
.ap-usage-moderation {
  display: inline-flex; align-items: center; gap: 4px; font-size: 10px;
  font-weight: 700; padding: 2px 6px; border-radius: 3px;
}
.ap-usage-moderation.isolated { background: var(--red-soft); color: var(--red); }
.ap-usage-moderation.rejected { background: #fee2e2; color: #dc2626; }
.ap-usage-moderation.appealed { background: var(--amber-soft); color: #b45309; }
.ap-usage-moderation.resolved { background: var(--green-soft); color: var(--green); }

/* 使用记录操作列：详情 + 申诉入口统一为单行横排文字链接（视觉收口，避免描边按钮换行竖排） */
#usageTable td:last-child { white-space: nowrap; }
.ap-usage-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.ap-usage-actions .link { font-size: 12px; line-height: 1; white-space: nowrap; cursor: pointer; }
/* 发起申诉：琥珀色，隔离后引导用户行动，可识别但不抢主视觉 */
.link.ap-appeal-link { color: #b45309; font-weight: 750; }
.link.ap-appeal-link:hover { color: #92400e; text-decoration: underline; }
/* 查看申诉：中性查看，与「详情」同色系 */
.link.ap-appeal-link.is-view { color: var(--brand); }
.link.ap-appeal-link.is-view:hover { color: var(--brand-strong); }

/* 申诉详情抽屉头部字段（renderDetailHeader 的 .tbp-kv）：
   该类原只在 admin 的 task-breakpoint.css 定义，console 侧未引入，导致标签与值粘连。
   这里在抽屉作用域内补齐「标签在上、值在下」的网格排版。 */
#apDrawerMask .tbp-kv { display: grid; gap: 3px; align-content: start; min-width: 0; }
#apDrawerMask .tbp-kv .kv-k {
  font-size: 11px; color: var(--muted); font-weight: 650; line-height: 1.3;
}
#apDrawerMask .tbp-kv .kv-v {
  font-size: 12px; font-weight: 700; line-height: 1.45;
  overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
#apDrawerMask .tbp-kv .kv-v.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px;
}

/* 申诉列表：审核结论列两行收口（悬浮 title 看全文），避免硬截断 + 行高参差 */
.ap-conclusion-cell {
  font-size: 10px; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; max-width: 260px;
}
/* 状态列审核员姓名不在窄列断行 */
.ap-reviewer-meta { white-space: nowrap; }
/* 操作列单行、与全站表格文字链接风格一致 */
.ap-list-table td.ap-row-action { white-space: nowrap; }
.ap-list-table .ap-row-action .link { font-size: 12px; cursor: pointer; }

/* ── 五终点覆盖层 ── */
.ap-state-overlay {
  padding: 40px 20px; text-align: center; display: grid; gap: 10px;
  justify-items: center; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface);
}
.ap-state-overlay .state-icon {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  font-size: 24px; font-weight: 850;
}
.ap-state-overlay.state-empty .state-icon { background: var(--surface-soft); color: var(--subtle); }
.ap-state-overlay.state-error .state-icon { background: var(--red-soft); color: var(--red); }
.ap-state-overlay.state-noperm .state-icon { background: var(--amber-soft); color: #b45309; }
.ap-state-overlay.state-cancel .state-icon { background: #fef3c7; color: #92400e; }
.ap-state-overlay strong { font-size: 15px; }
.ap-state-overlay p { margin: 0; color: var(--muted); font-size: 13px; max-width: 400px; line-height: 1.6; }

/* ── 待确认列表 ── */
.ap-pending-list {
  margin-top: 10px; padding: 10px 14px; background: var(--surface-soft);
  border: 1px solid var(--line); border-radius: 8px;
}
.ap-pending-list .pending-title {
  font-size: 11px; font-weight: 750; color: #b45309; margin-bottom: 6px;
}
.ap-pending-list ul { margin: 0; padding-left: 18px; }
.ap-pending-list li { font-size: 11px; color: var(--muted); line-height: 1.7; }

/* ── 统计栏（6 态，可点击筛选）── */
.ap-stat-row {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 12px;
}
.ap-stat {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); display: grid; gap: 2px; cursor: pointer; transition: border-color .12s, box-shadow .12s;
}
.ap-stat:hover { border-color: var(--brand); box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.ap-stat.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.ap-stat span { font-size: 11px; color: var(--muted); font-weight: 650; }
.ap-stat b { font-size: 20px; font-weight: 850; }
.ap-stat.ap-stat-pending b { color: #b45309; }
.ap-stat.ap-stat-first_review b { color: #1e40af; }
.ap-stat.ap-stat-awaiting_final b { color: #6d28d9; }
.ap-stat.ap-stat-resolved b { color: var(--green); }
.ap-stat.ap-stat-upheld b { color: var(--red); }
.ap-stat.ap-stat-cancel b { color: var(--muted); }
.ap-stat.ap-stat-reviewing b { color: #1e40af; }

/* ── 场景/终点栏（原型调试工具，视觉上与正常内容区分） ── */
.ap-scenario-bar,
.ap-endpoint-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px 12px; background: #f8fafc; border: 1px dashed #cbd5e1;
  border-radius: 8px; font-size: 11px; margin-bottom: 12px;
}
.ap-endpoint-bar .ep-label { color: #64748b; font-weight: 700; letter-spacing: .3px; }
.ap-scenario-btn,
.ap-endpoint-btn {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 5px;
  border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer;
}
.ap-scenario-btn:hover,
.ap-endpoint-btn:hover { border-color: var(--brand); color: var(--brand); }
.ap-scenario-btn.active,
.ap-endpoint-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 响应式 */
@media (max-width: 900px) {
  .ap-stat-row { grid-template-columns: repeat(2, 1fr); }
}

/* ══ B 分片新增：两审意见 / 结论盒 / 费用处置卡 ══ */

/* 两审意见区块 */
.ap-review-list { display: grid; gap: 8px; }
.ap-review-block {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  background: var(--surface-soft); display: grid; gap: 4px;
}
.ap-review-block.ap-review-final { background: #faf5ff; border-color: #e9d5ff; }
.ap-review-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ap-review-tag { font-size: 11px; font-weight: 800; color: var(--text); }
.ap-review-op { font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.ap-review-op.ap-op-good { background: var(--green-soft); color: var(--green); }
.ap-review-op.ap-op-bad { background: var(--red-soft); color: var(--red); }
.ap-review-op.ap-op-info { background: #dbeafe; color: #1e40af; }
.ap-review-meta { font-size: 10px; color: var(--subtle); }
.ap-review-reason { font-size: 11px; color: var(--muted); line-height: 1.6; }

/* 审核结论盒 */
.ap-conclusion-box {
  padding: 10px 12px; border-radius: 6px; font-size: 11px; line-height: 1.7;
  display: grid; gap: 4px;
}
.ap-conclusion-box.is-good { background: #ecfdf5; }
.ap-conclusion-box.is-bad { background: #fef2f2; }
.ap-conclusion-head { font-size: 12px; font-weight: 800; }
.ap-conclusion-box.is-good .ap-conclusion-head { color: #166534; }
.ap-conclusion-box.is-bad .ap-conclusion-head { color: #991b1b; }
.ap-conclusion-text { color: var(--text); }
.ap-conclusion-tail { font-size: 10px; }
.ap-conclusion-box.is-good .ap-conclusion-tail { color: #166534; }
.ap-conclusion-box.is-bad .ap-conclusion-tail { color: #991b1b; }
.ap-conclusion-actions { padding-top: 4px; }
.ap-upheld-lock {
  margin-top: 6px; padding: 6px 10px; border-radius: 6px;
  background: #fef2f2; border: 1px dashed #fecaca;
  font-size: 10px; font-weight: 800; color: #991b1b;
}

/* 费用处置卡片 */
.ap-fee-card {
  margin-top: 8px; padding: 10px 12px; border-radius: 6px;
  display: grid; gap: 4px; font-size: 11px;
}
.ap-fee-card.ap-fee-good { background: #ecfdf5; border: 1px solid #a7f3d0; color: #166534; }
.ap-fee-card.ap-fee-bad { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.ap-fee-card.ap-fee-info { background: #f0f9ff; border: 1px solid #bae6fd; color: #0c4a6e; }
.ap-fee-title { font-size: 11px; font-weight: 800; }
.ap-fee-row { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }
.ap-fee-row span:first-child { opacity: .8; }
.ap-fee-detail { font-size: 10px; line-height: 1.5; opacity: .85; }
