* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f7fa; color: #333; }
.page { min-height: 100vh; }

/* 登录页 */
#loginPage {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: linear-gradient(135deg, #1677ff 0%, #4096ff 100%);
}
.login-box {
  background: #fff; border-radius: 20px; padding: 48px 40px 36px;
  width: 380px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-title { text-align: center; font-size: 28px; font-weight: bold; color: #1677ff; }
.login-sub { text-align: center; font-size: 14px; color: #999; margin-top: 6px; margin-bottom: 32px; }
.login-input {
  width: 100%; padding: 14px 16px; border: 1px solid #e8e8e8; border-radius: 8px;
  font-size: 15px; margin-bottom: 16px; outline: none; transition: border-color 0.2s; box-sizing:border-box;
}
.login-input:focus { border-color: #1677ff; }
.login-btn {
  width: 100%; padding: 14px; border: none; border-radius: 8px; font-size: 16px;
  background: #1677ff; color: #fff; cursor: pointer; font-weight: bold;
}
.login-btn:active { background: #0958d9; }
.login-error { color: #ff4d4f; font-size: 14px; text-align: center; margin-top: 12px; min-height: 20px; }

/* 顶栏 */
.top-bar {
  background: #1677ff; color: #fff; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.top-left { display: flex; align-items: center; gap: 16px; }
.top-title { font-size: 20px; font-weight: bold; }
.top-role { font-size: 14px; opacity: 0.85; }
.top-logout {
  background: rgba(255,255,255,0.2); border: none; color: #fff;
  padding: 8px 20px; border-radius: 6px; cursor: pointer; font-size: 14px;
}

/* Tab 栏 */
.tab-bar {
  display: flex; background: #fff; border-bottom: 1px solid #f0f0f0;
  overflow-x: auto; white-space: nowrap;
}
.tab-item {
  padding: 14px 20px; font-size: 14px; cursor: pointer; color: #666;
  position: relative; flex-shrink: 0; user-select: none;
}
.tab-item:hover { background: #f9f9f9; }
.tab-item.active { color: #1677ff; font-weight: bold; }
.tab-item.active::after {
  content: ''; position: absolute; bottom: 0; left: 20%; right: 20%;
  height: 3px; background: #1677ff; border-radius: 3px;
}
.tab-badge {
  display: inline-block; background: #ff4d4f; color: #fff;
  font-size: 11px; padding: 1px 6px; border-radius: 10px;
  margin-left: 4px; vertical-align: top; min-width: 18px; text-align: center;
}
.tab-item .tab-badge { position: absolute; top: 6px; right: 2px; }

/* 搜索栏 */
.search-bar {
  display: flex; gap: 10px; padding: 12px 16px; background: #fff;
  border-bottom: 1px solid #f0f0f0;
}
.search-input {
  flex: 1; padding: 8px 12px; border: 1px solid #e8e8e8; border-radius: 6px;
  font-size: 14px; outline: none;
}
.search-input:focus { border-color: #1677ff; }
.search-btn, .refresh-btn {
  padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer;
  font-size: 14px; white-space: nowrap;
}
.search-btn { background: #1677ff; color: #fff; }
.refresh-btn { background: #f0f0f0; color: #666; }

/* 工单列表 */
.order-list { padding: 12px 16px; max-width: 1200px; margin: 0 auto; }
.empty-state { text-align: center; padding: 60px 20px; color: #999; font-size: 15px; }

/* 表格 */
.order-table {
  width: 100%; border-collapse: collapse; background: #fff;
  border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.order-table th {
  background: #fafafa; color: #666; font-size: 13px; font-weight: 600;
  padding: 12px 14px; text-align: left; border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}
.order-table td {
  padding: 11px 14px; font-size: 13px; color: #333;
  border-bottom: 1px solid #f5f5f5;
}
.order-table tbody tr { cursor: pointer; transition: background 0.15s; }
.order-table tbody tr:hover { background: #f0f5ff; }
.order-table tbody tr:last-child td { border-bottom: none; }
.order-table .addr-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-tag { font-weight: 600; }

/* 分页 */
.pagination {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 16px 0; gap: 12px;
}
.page-info { font-size: 13px; color: #999; }
.page-btn {
  padding: 6px 16px; border: 1px solid #d9d9d9; border-radius: 6px;
  background: #fff; color: #333; font-size: 13px; cursor: pointer;
  transition: all 0.15s;
}
.page-btn:hover:not(:disabled) { border-color: #1677ff; color: #1677ff; }
.page-btn:disabled { color: #ccc; cursor: not-allowed; background: #fafafa; }

/* 弹窗 */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 100;
}
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: #fff; border-radius: 12px; width: 760px; max-width: 94vw;
  max-height: 85vh; overflow-y: auto; z-index: 101;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.confirm-modal { width: 500px; }
.modal-header {
  padding: 18px 24px; border-bottom: 1px solid #f0f0f0;
  font-size: 17px; font-weight: bold; display: flex; justify-content: space-between; align-items: center;
}
.modal-close { font-size: 24px; cursor: pointer; color: #ccc; line-height: 1; }
.modal-close:hover { color: #666; }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid #f0f0f0;
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end;
}

/* 详情表单 */
.detail-card {
  border: 1px solid #eef0f3;
  border-radius: 8px;
  padding: 14px 16px 12px;
  margin-bottom: 14px;
  background: #fff;
}
.detail-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #1f2d3d;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid #f0f2f5;
}
.detail-field {
  display: flex; align-items: flex-start; margin-bottom: 10px;
}
.detail-field .dt-label {
  width: 86px; flex-shrink: 0; font-size: 14px; color: #7a8491; line-height: 30px;
}
.detail-field .dt-value {
  flex: 1; font-size: 14px; line-height: 30px; word-break: break-all;
}
.detail-field input, .detail-field textarea, .detail-field select {
  flex: 1; padding: 6px 10px; border: 1px solid #e8e8e8; border-radius: 6px;
  font-size: 14px; outline: none; font-family: inherit;
}
.detail-field input:focus, .detail-field textarea:focus { border-color: #1677ff; }
.detail-field input[disabled] { background: #f9f9f9; color: #666; border-color: transparent; }
.detail-section-title {
  font-size: 15px; font-weight: bold; color: #1677ff;
  margin: 16px 0 12px; padding-bottom: 6px; border-bottom: 1px solid #f0f0f0;
}
.sub-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #1677ff;
  margin: 12px 0 8px;
}
.detail-log {
  background: #f7f9fc;
  border: 1px solid #edf1f5;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.log-title {
  font-size: 13px;
  font-weight: 700;
  color: #4a5568;
  margin-bottom: 8px;
}
.empty-text {
  font-size: 14px;
  color: #9aa3af;
  padding: 4px 0;
}
.money-paid { color: #07c160; font-weight: 700; }
.money-unpaid { color: #ff4d4f; font-weight: 700; }
.multi-line { white-space: pre-wrap; word-break: break-all; line-height: 1.6; }

/* 图片 */
.img-section { margin: 12px 0 4px; }
.img-section .img-label { font-size: 13px; color: #666; display: block; margin-bottom: 6px; }
.img-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.img-grid img {
  width: 72px; height: 72px; border-radius: 6px; object-fit: cover;
  cursor: pointer; border: 1px solid #f0f0f0;
}
.img-grid img:hover { opacity: 0.85; }
.img-grid .img-more { font-size: 12px; color: #999; align-self: center; }

/* 按钮 */
.btn {
  padding: 8px 18px; border: none; border-radius: 6px; font-size: 14px;
  cursor: pointer; white-space: nowrap;
}
.btn-primary { background: #1677ff; color: #fff; }
.btn-primary:hover { background: #0958d9; }
.btn-success { background: #07c160; color: #fff; }
.btn-success:hover { background: #06ad56; }
.btn-warning { background: #fa8c16; color: #fff; }
.btn-warning:hover { background: #e07912; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-danger:hover { background: #e04345; }
.btn-default { background: #f0f0f0; color: #666; }
.btn-default:hover { background: #e5e5e5; }

/* 选择列表（派单） */
.selector-list { margin: 8px 0; }
.selector-item {
  padding: 12px 16px; border: 1px solid #e8e8e8; border-radius: 8px;
  margin-bottom: 8px; cursor: pointer; font-size: 14px; transition: all 0.15s;
}
.selector-item:hover { border-color: #1677ff; background: #f0f5ff; }

/* 密码管理表单 */
.pwd-form { padding: 8px 0; }
.pwd-form label {
  font-size: 15px; color: #333; display: block; margin-bottom: 8px;
  font-weight: 500;
}
.pwd-form .pwd-field {
  width: 100%; padding: 16px 16px; border: 1px solid #d9d9d9; border-radius: 8px;
  font-size: 16px; margin-bottom: 16px; outline: none; transition: border-color 0.2s;
  box-sizing: border-box; background: #fff;
  -webkit-appearance: none; appearance: none;
}
.pwd-form .pwd-field:focus { border-color: #1677ff; }
.pwd-form select.pwd-field {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}

/* 加载提示 */
.loading-box {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,0.75); border-radius: 12px; padding: 32px 40px;
  text-align: center; z-index: 200; color: #fff; font-size: 15px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.loading-spinner {
  width: 32px; height: 32px; border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 图片预览弹窗 */
#imagePreviewModal {
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out; z-index: 200;
}
.image-preview-container {
  position: relative; max-width: 90vw; max-height: 90vh;
  background: #000; border-radius: 8px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.image-preview-img {
  display: block; max-width: 90vw; max-height: 90vh;
  object-fit: contain;
}
.image-preview-close {
  position: absolute; top: 8px; right: 12px;
  font-size: 28px; color: #fff; cursor: pointer;
  z-index: 10; text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  line-height: 1;
}
.image-preview-close:hover { color: #ccc; }

/* 通知提示 */
.notification {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: #333; color: #fff; padding: 10px 24px; border-radius: 8px;
  font-size: 14px; z-index: 300; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  max-width: 80vw; text-align: center;
}

/* ===== 统计页面 ===== */
.stats-page { padding: 16px; max-width: 1200px; margin: 0 auto; }
.stats-date-bar {
  background: #fff; padding: 14px 20px; border-radius: 8px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04); margin-bottom: 16px;
  font-size: 14px; color: #666;
}
.stats-date-input {
  padding: 6px 10px; border: 1px solid #d9d9d9; border-radius: 6px;
  font-size: 14px; outline: none;
}
.stats-date-input:focus { border-color: #1677ff; }
.stats-query-btn {
  padding: 6px 20px; border: none; border-radius: 6px;
  background: #1677ff; color: #fff; font-size: 14px; cursor: pointer;
}
.stats-query-btn:hover { background: #0958d9; }

/* 总览卡片 */
.stats-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px;
  margin-bottom: 20px;
}
.stats-card {
  background: #fff; border-radius: 10px; padding: 20px 16px;
  text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.stats-card-number {
  font-size: 28px; font-weight: bold; color: #1677ff; line-height: 1.2;
}
.stats-card-label {
  font-size: 13px; color: #999; margin-top: 6px;
}

/* 统计章节标题 */
.stats-section-title {
  font-size: 16px; font-weight: bold; color: #333;
  margin: 20px 0 12px; padding-left: 12px;
  border-left: 3px solid #1677ff;
}

/* 统计表格 */
.stats-table {
  width: 100%; border-collapse: collapse; background: #fff;
  border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  margin-bottom: 8px;
}
.stats-table th {
  background: #fafafa; color: #666; font-size: 13px; font-weight: 600;
  padding: 10px 14px; text-align: left; border-bottom: 1px solid #f0f0f0;
}
.stats-table td {
  padding: 9px 14px; font-size: 13px; color: #333;
  border-bottom: 1px solid #f5f5f5;
}
.stats-table tbody tr:last-child td { border-bottom: none; }

/* 数字高亮 */
.stats-number {
  font-weight: 600; color: #1677ff; font-variant-numeric: tabular-nums;
}
.stats-money { color: #ff4d4f; font-size: 16px; }

/* 汇总行 */
.stats-summary-row {
  display: flex; gap: 24px; background: #fff; padding: 16px 20px;
  border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  margin-bottom: 8px;
}
.stats-summary-item {
  font-size: 14px; color: #333;
}

/* 响应式：小屏时卡片 3 列 */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

/* 收款记录 */
.payment-record {
  background: #f7f8fa; border-radius: 8px; padding: 10px 14px; margin-bottom: 8px;
}
.pay-amount { font-size: 14px; color: #333; font-weight: bold; margin-bottom: 4px; }
.pay-meta { font-size: 13px; color: #666; margin-bottom: 2px; }
.pay-remark { font-size: 13px; color: #999; margin-bottom: 2px; }
.pay-operator { font-size: 12px; color: #888; }
