/* ==================== 工单详情页 ==================== */
.detail-page {
  padding-top: calc(12px + var(--app-safe-area-top));
  padding-bottom: calc(50px + env(safe-area-inset-bottom));
  padding-left: 16px;
  padding-right: 16px;
}

/* ==================== 工单卡片 ==================== */
.repair-item {
  background: #fff;
  border-radius: 16px;
  padding: 16px 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.repair-item:active {
  transform: scale(0.98);
}

.repair-item.hidden {
  display: none !important;
}

.repair-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.repair-status {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(79, 195, 247, 0.15);
  color: #4FC3F7;
}

.repair-status.pending {
  background: rgba(79, 195, 247, 0.15);
  color: #4FC3F7;
}

.repair-status.dispatched {
  background: rgba(251, 192, 45, 0.15);
  color: #FBC02D;
}

.repair-status.repairing,
.repair-status.processing {
  background: rgba(255, 112, 67, 0.15);
  color: #FF7043;
}

.repair-status.pending-confirmation,
.repair-status.pending_confirmation {
  background: rgba(149, 117, 205, 0.15);
  color: #9575CD;
}

.repair-status.completed {
  background: rgba(102, 187, 106, 0.15);
  color: #66BB6A;
}

.repair-status.cancelled {
  background: rgba(255, 107, 107, 0.15);
  color: #ff6b6b;
}

.repair-time {
  font-size: 12px;
  color: var(--text-light);
}

.repair-item-content {
  margin-bottom: 12px;
}

.repair-item-summary {
  cursor: pointer;
}

.repair-title-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 8px;
  word-break: break-word;
}

.repair-view-tip {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--primary-color);
}

.repair-location {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.repair-icon {
  width: 16px;
  height: 16px;
}

.repair-location span {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}

.repair-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.repair-order {
  font-size: 12px;
  color: var(--text-light);
}

.repair-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  margin: 12px 0;
  border-top: 1px dashed #eee;
  border-bottom: 1px dashed #eee;
  width: 100%;
  box-sizing: border-box;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  width: 44px;
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ddd;
  transition: all var(--transition-fast);
}

.progress-step.completed .step-dot {
  background: var(--primary-color);
}

.progress-step.active .step-dot {
  background: var(--primary-color);
  animation: pulse 1.5s ease-in-out infinite;
}

.step-label {
  font-size: 10px;
  color: var(--text-light);
  text-align: center;
  white-space: nowrap;
}

.progress-step.completed .step-label,
.progress-step.active .step-label {
  color: var(--primary-color);
  font-weight: 600;
}

.repair-item-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ==================== 详情页头部 ==================== */
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #fff;
  border-radius: 16px;
  margin-bottom: 16px;
  box-shadow: none;
}

.detail-back-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  color: #f56351;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.detail-back-btn:active {
  background: transparent;
  transform: scale(0.95);
}

.detail-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.detail-header-spacer {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.detail-status-badge {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary-color);
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.detail-status-badge.pending {
  background: #E1F5FE;
  color: #4FC3F7;
}

.detail-status-badge.dispatched {
  background: #FFF9C4;
  color: #FBC02D;
}

.detail-status-badge.repairing,
.detail-status-badge.processing {
  background: #FBE9E7;
  color: #FF7043;
}

.detail-status-badge.pending-confirmation,
.detail-status-badge.pending_confirmation {
  background: #EDE7F6;
  color: #9575CD;
}

.detail-status-badge.completed {
  background: #E8F5E9;
  color: #66BB6A;
}

.detail-status-badge.cancelled {
  background: #ffebee;
  color: #f44336;
}

.detail-status-badge.teal {
  background: #E0F7FA;
  color: #00BCD4;
}

.detail-status-badge.purple {
  background: #F3E5F5;
  color: #AB47BC;
}

.detail-status-badge.indigo {
  background: #E8EAF6;
  color: #5C6BC0;
}

.detail-status-badge.pink {
  background: #FCE4EC;
  color: #EC407A;
}

.detail-status-badge.brown {
  background: #EFEBE9;
  color: #8D6E63;
}

.detail-status-badge.lime {
  background: #F0F4C3;
  color: #9CCC65;
}

.order-status-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.order-status-badge.pending {
  background: #E1F5FE;
  color: #4FC3F7;
}

.order-status-badge.dispatched {
  background: #FFF9C4;
  color: #FBC02D;
}

.order-status-badge.repairing,
.order-status-badge.processing {
  background: #FBE9E7;
  color: #FF7043;
}

.order-status-badge.pending_confirmation {
  background: #EDE7F6;
  color: #9575CD;
}

.order-status-badge.completed {
  background: #E8F5E9;
  color: #66BB6A;
}

.order-status-badge.cancelled {
  background: #ffebee;
  color: #f44336;
}

.order-status-badge.teal {
  background: #E0F7FA;
  color: #00BCD4;
}

.order-status-badge.purple {
  background: #F3E5F5;
  color: #AB47BC;
}

.order-status-badge.indigo {
  background: #E8EAF6;
  color: #5C6BC0;
}

.order-status-badge.pink {
  background: #FCE4EC;
  color: #EC407A;
}

.order-status-badge.brown {
  background: #EFEBE9;
  color: #8D6E63;
}

.order-status-badge.lime {
  background: #F0F4C3;
  color: #9CCC65;
}

.detail-content {
  background: #fff;
  border-radius: 16px;
  padding: 20px 16px;
  box-shadow: var(--shadow-sm);
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.detail-icon {
  width: 24px;
  height: 24px;
  color: var(--primary-color);
}

.detail-icon path {
  fill: currentColor;
}

.detail-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.detail-info-item {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 0;
}

.info-label,
.detail-info-label {
  font-size: 12px;
  color: var(--text-light);
  display: block;
  margin-bottom: 4px;
}

.info-value,
.detail-info-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
  word-break: break-word;
}

.info-value.order-no {
  color: var(--primary-color);
}

.info-value.priority-tag,
.detail-info-value.priority-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  line-height: 1.4;
}

.detail-phone {
  color: var(--primary-color) !important;
}

.detail-description,
.detail-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  padding: 16px 16px;
  background: #f8f9fa;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.detail-images img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 12px;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.detail-images img:active {
  transform: scale(0.95);
}

/* ==================== 进度步骤条 ==================== */
.detail-footer {
  padding: 16px 0 24px;
  background: #fff;
}

.progress-track {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  position: relative;
}

/* 连线 */
.progress-track::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 16px;
  right: 16px;
  height: 1px;
  background: #e8e8e8;
  z-index: 0;
  transform: translateY(-50%);
}

.progress-step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  border: none;
  border-radius: 20px;
  margin: 0 4px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #999;
  background: #f5f5f5;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s ease;
}

/* ─ 待处理 ─ */
.progress-step.step-wait {
  color: #b0b0b0;
  background: #f5f5f5;
}

/* ─ 进行中 ─ */
.progress-step.step-active {
  color: #fff;
  background: #4f6ef7;
  font-weight: 600;
}

/* ─ 已完成 ─ */
.progress-step.step-done {
  color: #b0b0b0;
  background: #f0f0f0;
}

/* 已完成-绿色 */
.progress-step.step-done.step-done-green {
  color: #fff;
  background: #22c55e;
  font-weight: 600;
}

/* 已撤销-红色 */
.progress-step.step-done.step-done-cancelled {
  color: #fff;
  background: #ef4444;
  font-weight: 600;
}

/* 待确认-橙色 */
.progress-step.step-active.step-wait-confirm {
  color: #fff;
  background: #d97706;
  font-weight: 600;
}

.detail-timeline {
  position: relative;
  padding-left: 46px;
}

.detail-timeline::before {
  display: none;
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.timeline-item.completed .timeline-dot {
  background: #4caf50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.timeline-item.active .timeline-dot {
  background: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(245, 99, 81, 0.3);
  animation: pulse 2s infinite;
}

.timeline-item.pending .timeline-dot {
  background: #ddd;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.timeline-item.cancelled .timeline-dot {
  background: #f44336;
  box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.2);
}

.timeline-item.cancelled .timeline-title {
  color: #f44336;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 20px;
  bottom: 0;
  width: 2px;
  background: #e0e0e0;
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-item.completed + .timeline-item.completed::before {
  background: #4caf50;
}

.timeline-item.completed + .timeline-item.active::before {
  background: linear-gradient(to bottom, #4caf50, var(--primary-color));
}

@media (prefers-color-scheme: dark) {
  .timeline-item::before {
    background: rgba(255, 255, 255, 0.1);
  }
  .timeline-item.pending .timeline-dot {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
  }
}

.timeline-content {
  flex: 1;
  min-width: 0;
}

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

.timeline-item.pending .timeline-title {
  color: var(--text-light);
}

.timeline-time {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.timeline-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.5;
  word-break: break-word;
}

.detail-timeline .timeline-title {
  font-size: 16px;
  font-weight: 600;
  color: #666;
}

.detail-timeline .timeline-time {
  display: block;
  color: #bbb;
  margin-top: 0;
  margin-bottom: 4px;
}

.detail-timeline .timeline-desc {
  color: #999;
  line-height: 1.4;
}

.detail-timeline .timeline-item {
  color: var(--step-color, #aaa);
  padding-bottom: 24px;
}

.detail-timeline .timeline-item::before {
  content: '';
  position: absolute;
  left: -32px;
  top: 24px;
  bottom: -24px;
  width: 2px;
  background-color: #e0e0e0;
  transform: translateX(-50%);
}

.detail-timeline .timeline-item:last-child::before {
  display: none;
}

.detail-timeline .timeline-item.completed::before {
  background-color: currentColor;
}

.detail-timeline .timeline-item.step-0 { --step-color: #4FC3F7; --step-bg: #E1F5FE; --step-border: #B3E5FC; --step-text: #0288D1; --step-shadow: rgba(79, 195, 247, 0.12); }
.detail-timeline .timeline-item.step-1 { --step-color: #FBC02D; --step-bg: #FFF9C4; --step-border: #FFF59D; --step-text: #F57F17; --step-shadow: rgba(251, 192, 45, 0.12); }
.detail-timeline .timeline-item.step-2 { --step-color: #FF7043; --step-bg: #FBE9E7; --step-border: #FFCCBC; --step-text: #D84315; --step-shadow: rgba(255, 112, 67, 0.12); }
.detail-timeline .timeline-item.step-3 { --step-color: #9575CD; --step-bg: #EDE7F6; --step-border: #D1C4E9; --step-text: #6A1B9A; --step-shadow: rgba(149, 117, 205, 0.12); }
.detail-timeline .timeline-item.step-4 { --step-color: #66BB6A; --step-bg: #E8F5E9; --step-border: #C8E6C9; --step-text: #2E7D32; --step-shadow: rgba(102, 187, 106, 0.12); }
.detail-timeline .timeline-item.step-0::before { background: #4FC3F7 !important; }
.detail-timeline .timeline-item.step-1::before { background: #FBC02D !important; }
.detail-timeline .timeline-item.step-2::before { background: #FF7043 !important; }
.detail-timeline .timeline-item.step-3::before { background: #9575CD !important; }

.detail-timeline .timeline-dot {
  position: absolute;
  left: -44px;
  top: 0;
  width: 24px;
  height: 24px;
  margin-top: 0;
  border: 2px solid #ddd;
  border-radius: 50%;
  background: #f5f5f5;
  color: #aaa;
  box-shadow: none;
}

.detail-timeline .timeline-dot::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.detail-timeline .timeline-item.completed .timeline-dot {
  background-color: #fff;
  border-color: var(--step-color);
  color: var(--step-color);
  box-shadow: 0 0 0 4px var(--step-shadow);
}

.detail-timeline .timeline-item.completed .timeline-dot::after {
  left: 6px;
  top: 6px;
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 50%;
  background: currentColor;
  transform: none;
}

.detail-timeline .timeline-item.active .timeline-dot {
  background-color: #fff;
  border-color: var(--step-color);
  color: var(--step-color);
  box-shadow: 0 0 0 4px var(--step-shadow);
  animation: none;
}

.detail-timeline .timeline-item.active .timeline-dot::after {
  left: 6px;
  top: 6px;
  width: 8px;
  height: 8px;
  background: var(--step-color);
}

.detail-timeline .timeline-content {
  position: relative;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 16px;
  box-shadow: none;
  transition: all 0.3s ease;
}

.detail-timeline .timeline-item.completed .timeline-content,
.detail-timeline .timeline-item.active .timeline-content {
  background-color: var(--step-bg);
  border-color: var(--step-border);
}

.detail-timeline .timeline-item.completed .timeline-title,
.detail-timeline .timeline-item.active .timeline-title {
  color: var(--step-text);
}

.detail-timeline .timeline-item.active .timeline-title {
  font-weight: 700;
}

.copy-phone-btn {
  border: 0;
  background: rgba(37, 150, 255, 0.12);
  color: #2596ff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  line-height: 1.6;
  cursor: pointer;
}

.copy-phone-btn:active {
  background: rgba(37, 150, 255, 0.22);
}

/* ==================== 完工弹窗 ==================== */
.complete-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.complete-overlay.show {
  opacity: 1;
}

.complete-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform var(--transition-normal);
}

.complete-overlay.show .complete-modal {
  transform: translateY(0);
}

@media (prefers-color-scheme: dark) {
  .complete-modal {
    background: #1a1a2e;
  }
}

.complete-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.complete-modal-header span {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.complete-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-light);
  transition: background var(--transition-fast);
}

.complete-modal-close:active {
  background: rgba(0, 0, 0, 0.05);
}

.complete-modal-body {
  padding: 20px;
}

.complete-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
  display: block;
}

.complete-textarea {
  width: 100%;
  height: 120px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-light);
  resize: none;
  outline: none;
  transition: border-color var(--transition-fast);
  font-family: inherit;
}

.complete-textarea:focus {
  border-color: var(--primary-color);
}

.complete-textarea::placeholder {
  color: var(--text-light);
}

.complete-char-count {
  display: block;
  text-align: right;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
}

.complete-modal-footer {
  display: flex;
  gap: 12px;
  padding: 0 20px 20px;
}

.complete-cancel-btn,
.complete-confirm-btn {
  flex: 1;
  height: 44px;
  border-radius: 22px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.complete-cancel-btn {
  background: var(--bg-light);
  color: var(--text-secondary);
}

.complete-cancel-btn:active {
  background: #e0e0e0;
}

.complete-confirm-btn {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.complete-confirm-btn:active {
  transform: scale(0.97);
}

.complete-confirm-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

