/**
 * 移动 OA 详情 — 与桌面 doc-detail / oa-timeline 同结构，独立 token 适配 office.css
 */
:root {
  --oa-detail-brand: var(--m-brand, #0369a1);
  --oa-detail-brand-light: #e0f2fe;
  --oa-detail-success: var(--m-success, #059669);
  --oa-detail-success-bg: #ecfdf5;
  --oa-detail-danger: var(--m-danger, #dc2626);
  --oa-detail-danger-bg: #fef2f2;
  --oa-detail-warn-bg: #fffbeb;
  --oa-detail-warn-fg: #b45309;
}

.oa-detail-doc {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 14px;
  color: var(--m-text);
  line-height: 1.5;
}

.oa-detail-doc .mb-3 {
  margin-bottom: 0;
}

/* —— 区块卡片 —— */
.doc-detail-section {
  border: 1px solid var(--m-border);
  border-radius: 12px;
  background: var(--m-surface);
  overflow: hidden;
}

.doc-detail-section__title {
  margin: 0;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--m-border);
  background: #f8fafc;
  color: var(--m-text);
}

/* —— Hero —— */
.doc-detail-hero {
  border: 1px solid var(--m-border);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--m-surface) 0%, var(--oa-detail-brand-light) 100%);
  padding: 14px 16px;
}

.doc-detail-hero__top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.doc-detail-hero__meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.doc-detail-hero__type {
  font-size: 12px;
  font-weight: 700;
  color: var(--oa-detail-brand);
}

.doc-detail-hero__id {
  font-size: 13px;
  color: var(--m-muted);
  word-break: break-all;
}

.doc-detail-hero__amounts {
  text-align: right;
  flex-shrink: 0;
}

.doc-detail-hero__amount-label {
  display: block;
  font-size: 11px;
  color: var(--m-muted);
  margin-bottom: 2px;
}

.doc-detail-hero__amount {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: var(--m-text);
}

.doc-detail-hero__amount-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.doc-detail-mini-amt {
  border: 1px solid var(--m-border);
  border-radius: 8px;
  background: var(--m-surface);
  padding: 6px 10px;
  text-align: right;
  min-width: 4.5rem;
}

.doc-detail-mini-amt__label {
  display: block;
  font-size: 10px;
  color: var(--m-muted);
}

.doc-detail-mini-amt__value {
  display: block;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.doc-detail-gate-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.doc-detail-gate-strip__label {
  font-size: 10px;
  font-weight: 600;
  color: var(--m-muted);
  letter-spacing: 0.04em;
}

/* —— KV 网格 —— */
.doc-detail-kv-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 4px 14px 12px;
}

.doc-detail-kv-row {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #f1f5f9;
  line-height: 1.45;
}

.doc-detail-kv-row:last-child {
  border-bottom: 0;
}

.doc-detail-kv-row--wide {
  grid-column: 1 / -1;
}

.doc-detail-kv-row__label {
  flex: 0 0 5.5rem;
  font-size: 13px;
  color: var(--m-muted);
}

.doc-detail-kv-row__value {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--m-text);
}

.doc-detail-summary {
  margin: 0;
  padding: 12px 14px;
  white-space: pre-wrap;
  line-height: 1.55;
  color: var(--m-text);
  background: #f8fafc;
  border-top: 1px solid var(--m-border);
}

/* —— 附件 —— */
.doc-detail-att-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
}

.doc-detail-att-link {
  display: block;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #bae6fd;
  background: #f0f9ff;
  font-size: 14px;
  color: var(--oa-detail-brand);
  word-break: break-all;
  text-decoration: none;
}

.doc-detail-att-link:active {
  background: #e0f2fe;
}

/* —— 明细表（横向滚动，不撑破屏宽） —— */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
}

.doc-detail-items-wrap {
  padding: 0 8px 10px;
}

.oa-detail-doc .table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  font-size: 13px;
}

.oa-detail-embedded-table .table {
  min-width: 520px;
}

.doc-detail-items-table {
  min-width: 360px;
}

.oa-detail-doc .table thead {
  background: #f8fafc;
}

.oa-detail-doc .table th {
  padding: 8px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--m-muted);
  border-bottom: 1px solid var(--m-border);
  white-space: nowrap;
}

.oa-detail-doc .table td {
  padding: 10px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
  color: var(--m-text);
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
}

.oa-detail-doc .table tbody tr:last-child td {
  border-bottom: none;
}

.doc-detail-items-table th.num,
.doc-detail-items-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.doc-detail-items-table .doc-detail-items-extra {
  font-size: 11px;
  color: var(--m-muted);
  margin-top: 2px;
}

/* —— 状态胶囊 —— */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill--running {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.status-pill--done {
  background: var(--oa-detail-success-bg);
  border-color: #a7f3d0;
  color: var(--oa-detail-success);
}

.status-pill--reject {
  background: var(--oa-detail-danger-bg);
  border-color: #fecaca;
  color: var(--oa-detail-danger);
}

.status-pill--withdraw {
  background: #f1f5f9;
  border-color: var(--m-border);
  color: var(--m-muted);
}

/* —— 审批时间线 —— */
.oa-timeline {
  border: none;
  border-radius: 0;
  padding: 10px 14px 14px;
  background: transparent;
}

.oa-timeline-group + .oa-timeline-group {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--m-border);
}

.oa-timeline-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--m-muted);
  margin-bottom: 6px !important;
}

.oa-timeline-item {
  position: relative;
  padding: 8px 0 8px 18px;
  border-left: 2px solid var(--m-border);
  margin-left: 6px;
}

.oa-timeline-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--oa-detail-brand);
  border: 2px solid var(--oa-detail-brand-light);
  box-sizing: border-box;
}

.oa-timeline-item.is-end::before {
  background: var(--oa-detail-success);
  border-color: #a7f3d0;
}

.oa-timeline-item.is-reject::before {
  background: var(--oa-detail-danger);
  border-color: #fecaca;
}

.oa-timeline-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--m-text);
}

.oa-timeline-meta {
  font-size: 12px;
  color: var(--m-muted);
  margin-top: 2px;
}

.doc-detail-error {
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fef2f2;
  padding: 12px 14px;
  font-size: 13px;
  color: #991b1b;
}
