* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #333;
  padding-bottom: 90px;
}

.hidden { display: none !important; }

.error-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fdecea;
  color: #c0392b;
  border-bottom: 1px solid #f5c6c0;
  padding: 10px 20px;
  font-size: 14px;
}
.error-banner button {
  background: none;
  border: none;
  font-size: 18px;
  color: #c0392b;
  cursor: pointer;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid #e5e6eb;
}
.topbar h1 { font-size: 20px; margin-right: auto; }

.date-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-controls .sep { color: #999; }

.quick-btn {
  border: 1px solid #d9d9d9;
  background: #fff;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}
.quick-btn.active { border-color: #ff6a00; color: #ff6a00; }

input[type="date"], input[type="text"], input[type="password"], input[type="number"], select {
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 13px;
}

.limit-input { width: 72px; }

.btn {
  border: 1px solid #d9d9d9;
  background: #fff;
  border-radius: 4px;
  padding: 7px 16px;
  cursor: pointer;
  font-size: 13px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #ff6a00; border-color: #ff6a00; color: #fff; }
.btn-danger { background: #e64545; border-color: #e64545; color: #fff; }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  padding: 20px 24px 4px;
}
.card {
  background: #fff;
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.card-label { font-size: 13px; color: #888; margin-bottom: 8px; }
.card-value { font-size: 24px; font-weight: 600; }
.card-note { font-size: 11px; color: #bbb; margin-top: 6px; }

.panel {
  background: #fff;
  border-radius: 8px;
  margin: 16px 24px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-header h2 { font-size: 16px; }
.filters { display: flex; gap: 8px; }

.refund-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.refund-table th, .refund-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #f0f0f0;
  text-align: left;
}
.refund-table th { color: #888; font-weight: 500; background: #fafafa; }
.col-check { width: 36px; }
.empty { text-align: center; color: #aaa; padding: 30px 0 !important; }

.link-btn {
  background: none;
  border: none;
  color: #ff6a00;
  cursor: pointer;
  font-size: 13px;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  background: #f0f0f0;
  color: #666;
}
.status-1 { background: #fff4e5; color: #d48806; }
.status-4 { background: #f0f0f0; color: #999; }
.status-5 { background: #e9f7ef; color: #1e9e5a; }

/* 售后类型徽标：1=仅退款（默认灰），2=退货退款（橙色区分） */
.type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  background: #f0f0f0;
  color: #666;
}
.type-2 { background: #fff1e6; color: #ff6a00; }

.batch-actions { margin-top: 8px; }

.breakdown-panel summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  outline: none;
}
.breakdown-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 14px;
}
.breakdown-col h3 { font-size: 13px; color: #888; margin-bottom: 8px; }
.breakdown-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.breakdown-table th, .breakdown-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #f0f0f0;
  text-align: left;
}
.breakdown-table th { color: #888; font-weight: 500; background: #fafafa; }
@media (max-width: 700px) {
  .breakdown-tables { grid-template-columns: 1fr; }
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 14px;
  font-size: 13px;
  color: #888;
}

.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: #fff;
  border-top: 1px solid #e5e6eb;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  font-size: 14px;
}
.action-bar b { color: #ff6a00; }
.action-bar .btn-danger { margin-left: auto; padding: 9px 22px; font-size: 14px; }

.settings-panel summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  outline: none;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 18px;
  margin: 16px 0;
}
.settings-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #666; }
.settings-grid .span-2 { grid-column: span 2; }
.save-msg { margin-left: 12px; font-size: 13px; color: #1e9e5a; }

.progress-header {
  display: flex;
  gap: 18px;
  align-items: center;
  font-size: 14px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.progress-stage { font-weight: 600; }
.progress-bar {
  height: 10px;
  background: #f0f0f0;
  border-radius: 5px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: #ff6a00;
  border-radius: 5px;
  transition: width 0.4s ease;
}
.sync-result { font-size: 13px; margin-top: 10px; }
.sync-result.ok-text { color: #1e9e5a; }
.sync-result.err-text { color: #c0392b; }
.sync-log {
  margin-top: 10px;
  max-height: 140px;
  overflow-y: auto;
  background: #fafafa;
  border: 1px solid #f0f0f0;
  border-radius: 6px;
  padding: 8px 12px;
  font-family: Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  color: #666;
}
.history-panel { padding: 12px 18px; }
.history-title { font-size: 14px; margin-bottom: 8px; }
.sync-history { list-style: none; font-size: 12px; color: #666; }
.sync-history li { padding: 4px 0; border-bottom: 1px solid #f5f5f5; }
.sync-history li:last-child { border-bottom: none; }
.sync-history .err-text { color: #c0392b; }

.sync-log .ok { color: #1e9e5a; }
.sync-log .fail { color: #c0392b; }
.sync-log .skipped { color: #999; }
.pending-info { font-size: 13px; color: #888; }
.pending-info.warn-text { color: #d48806; }
.btn.active { border-color: #ff6a00; color: #ff6a00; }

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: #fff;
  border-radius: 8px;
  padding: 22px 24px;
  width: 440px;
  max-width: 92vw;
  max-height: 84vh;
  overflow: auto;
}
.modal-wide { width: 720px; }
.modal h3 { font-size: 16px; margin-bottom: 14px; }
.modal p { font-size: 14px; margin-bottom: 10px; }
.warn-text { color: #c0392b; font-size: 13px !important; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.result-list { list-style: none; max-height: 300px; overflow: auto; font-size: 13px; }
.result-list li {
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.result-list .ok { color: #1e9e5a; }
.result-list .fail { color: #c0392b; }
.result-list .skipped { color: #999; }

.order-no-tag { font-size: 12px; color: #999; font-weight: 400; }
.json-view {
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: 6px;
  padding: 14px;
  font-size: 12px;
  line-height: 1.5;
  max-height: 50vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 多店铺 */
.store-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 12px 20px 0;
}
.store-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.store-tab {
  padding: 6px 14px; border: 1px solid #e0e0e0; border-radius: 16px;
  background: #fff; cursor: pointer; font-size: 13px; color: #555;
}
.store-tab.active { border-color: #ff6a00; color: #ff6a00; font-weight: 600; }
.store-tab:hover { border-color: #ff6a00; }

/* 店铺列只在「全部店铺」视图显示 */
body:not(.all-view) .store-col { display: none; }

.compare-table .sortable { cursor: pointer; user-select: none; }
.compare-table .sortable:hover { color: #ff6a00; }
.compare-table .sort-asc::after { content: ' ↑'; }
.compare-table .sort-desc::after { content: ' ↓'; }
.compare-name { font-weight: 600; }

.settings-store-label { font-size: 13px; color: #666; margin: 0 0 12px; }
.modal-form { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.modal-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #666; }
.modal-form input {
  padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px;
}

/* 自动刷新开关（开启时绿色 active 态） */
.btn-active { background: #1e9e5a; border-color: #1e9e5a; color: #fff; }

/* 自动退款设置 */
.auto-refund-box {
  border: 1px solid #eee; border-radius: 8px; padding: 10px 14px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  font-size: 13px; color: #666;
}
.auto-refund-box legend { font-size: 13px; color: #888; padding: 0 4px; }
.auto-refund-box .radio-inline { display: flex; align-items: center; gap: 4px; flex-direction: row; }
.delay-minutes-label { display: flex; align-items: center; gap: 6px; flex-direction: row; }
.delay-minutes-label input { width: 72px; }
.auto-refund-last { color: #1e9e5a; }
.auto-refund-since { color: #b26a00; }

/* 自动退款引擎启停按钮 */
.engine-btn {
  border: 1px solid #d9d9d9; background: #fff; border-radius: 4px;
  padding: 5px 14px; cursor: pointer; font-size: 13px; color: #666;
}
.engine-btn.running {
  background: #1e9e5a; border-color: #1e9e5a; color: #fff;
}
.engine-btn.stopped {
  background: #f0f0f0; border-color: #d9d9d9; color: #888;
}

/* 自动退款日志面板 */
.auto-refund-log-box {
  border: 1px solid #eee; border-radius: 8px; padding: 10px 14px;
}
.auto-refund-log-box .log-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.auto-refund-log-box .log-title { font-size: 13px; color: #888; }
.auto-refund-log-box .autorefresh-btn {
  border: 1px solid #d9d9d9; background: #fff; border-radius: 4px;
  padding: 3px 10px; cursor: pointer; font-size: 12px; color: #666;
}
.auto-refund-log-box .autorefresh-btn.btn-active {
  background: #1e9e5a; border-color: #1e9e5a; color: #fff;
}
.auto-refund-log-box .log-clear-btn {
  border: none; background: none; cursor: pointer; font-size: 12px; color: #bbb;
}
.auto-refund-log-box .log-clear-btn:hover { color: #e64545; }
.auto-refund-log-panel {
  height: 180px; overflow-y: auto; background: #fafafa;
  border: 1px solid #f0f0f0; border-radius: 6px; padding: 6px 10px;
  font-family: Menlo, Consolas, monospace; font-size: 12px; line-height: 1.7;
  color: #555; white-space: pre-wrap; word-break: break-all;
}
.auto-refund-log-panel .log-warn { color: #b26a00; }
.auto-refund-log-panel .log-error { color: #e64545; }
