:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2733;
  --muted: #7b8494;
  --border: #e4e8ef;
  --primary: #245bdb;
  --primary-hover: #1b49b5;
  --ok: #0f7b46;
  --error: #c0392b;
  --soft-blue: #eef3ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

button, input { font: inherit; }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, #eef3ff 0%, #f7f8fb 55%, #eaf0fb 100%);
  padding: 24px 16px;
}

.login-box {
  width: 390px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 16px 48px rgba(27, 54, 110, 0.08);
}

.login-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.login-head h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: .3px; }

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary);
  position: relative;
  flex: none;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 2px solid #fff;
  border-radius: 3px;
  transform: rotate(45deg);
}

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; margin-bottom: 6px; color: #4b5563; }

input[type="text"], input[type="password"] {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36, 91, 219, .12); }
input::placeholder { color: #b6bdc9; }

.captcha-row { display: flex; gap: 10px; }
.captcha-row input { flex: 1; min-width: 0; }

.captcha-image {
  width: 112px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
  cursor: pointer;
  overflow: hidden;
  flex: none;
}

.captcha-image:hover { border-color: var(--primary); }
.captcha-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

.button {
  height: 38px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.button:hover { border-color: #c6cedb; }
.button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-hover); }
.button.danger { background: #fff5f4; border-color: #e9a6a0; color: #b63b32; }
.button.danger:hover { background: #ffe9e7; border-color: #d9867e; }
.button:disabled { opacity: .6; cursor: not-allowed; }
.button.full { width: 100%; margin-top: 6px; }

.error-line {
  margin-bottom: 14px;
  padding: 9px 12px;
  border-radius: 8px;
  background: #fdecea;
  color: var(--error);
  font-size: 13px;
}

.help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.login-foot { margin-top: 20px; text-align: center; font-size: 12px; color: var(--muted); }
.link { color: var(--primary); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- 主页面 ---------- */
/* 整屏固定高度：侧边栏与顶栏不滚动，内容区内部滚动，保证退出按钮/分页器始终可见 */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 208px;
  flex: none;
  height: 100vh;
  background: #17223a;
  color: #cbd5e8;
  display: flex;
  flex-direction: column;
}

.sidebar-head {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.sidebar-head .brand-mark { width: 26px; height: 26px; border-radius: 7px; }
.sidebar-head .brand-mark::after { inset: 7px; border-width: 1.5px; }

.menu { padding: 14px 10px; flex: 1; }

.menu-group { font-size: 11px; color: #7f8da8; padding: 10px 10px 6px; letter-spacing: .5px; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: #cbd5e8;
  font-size: 14px;
}

.menu-item:hover { background: rgba(255,255,255,.06); }
.menu-item.active { background: var(--primary); color: #fff; }
.menu-item .icon { width: 16px; text-align: center; opacity: .9; }

.sidebar-foot {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-foot button {
  color: #cbd5e8;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.sidebar-foot button:hover { color: #fff; text-decoration: underline; }

.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }

.topbar {
  height: 64px;
  flex: none;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.topbar h2 { margin: 0; font-size: 16px; font-weight: 600; }
.topbar .user { font-size: 13px; color: var(--muted); }

.content { flex: 1; min-height: 0; padding: 18px 28px 18px; overflow: auto; }

/* 报表视图：占满内容区高度，表格区自适应伸缩，分页器固定在底部（整页可见） */
#reportView { height: 100%; }
#reportView > .panel {
  height: 100%;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#reportView > .panel > .result-head,
#reportView > .panel > .platform-tabs,
#reportView > .panel > .report-summary,
#reportView > .panel > .filter-row,
#reportView > .panel > .pager { flex: none; }

#shopReportView { height: 100%; }
#shopReportView > .panel {
  height: 100%; margin-bottom: 0;
  display: flex; flex-direction: column; min-height: 0;
}
#shopReportView > .panel > .result-head,
#shopReportView > .panel > .platform-tabs,
#shopReportView > .panel > .filter-row { flex: none; }
#shopReportView .shop-report-wrap { flex: 1; max-height: none; }

#asinReportView { height: 100%; }
#asinReportView > .panel {
  height: 100%; margin-bottom: 0;
  display: flex; flex-direction: column; min-height: 0;
}
#asinReportView > .panel > .result-head,
#asinReportView > .panel > .platform-tabs,
#asinReportView > .panel > .filter-row { flex: none; }
#asinReportView .shop-report-wrap { flex: 1; max-height: none; }
.asin-thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 18px;
}

.panel h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.panel .desc { margin: 0 0 18px; color: var(--muted); font-size: 12px; }

.search-row { display: flex; gap: 10px; flex-wrap: wrap; }
.search-row input { flex: 1; min-width: 240px; height: 40px; }
.search-row select { height: 40px; max-width: 160px; }
.search-row .button { height: 40px; }

/* 订单查询平台选择：自定义图标 + 箭头，去掉原生样式 */
.platform-select {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  min-width: 132px;
  height: 40px;
  padding: 0 34px 0 36px;
  border: 1px solid #d8e0ec;
  border-radius: 9px;
  background-color: #f8fafc;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23245bdb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 10px center, right 10px center;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.platform-select:hover { border-color: #b6c4de; background-color: #f1f5fb; }
.platform-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36, 91, 219, .12); }

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.result-head h3 { margin: 0; }
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  background: var(--soft-blue);
  color: var(--primary);
  font-size: 12px;
}
.badge.history { background: #fff4e5; color: #a35b00; }

.history-banner {
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid #f0d7a8;
  border-radius: 8px;
  background: #fff9ee;
  color: #8a5a12;
  font-size: 12px;
}
.history-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  background: #fff4e5;
  color: #a35b00;
  font-size: 11px;
}
.history-note {
  margin: 8px 0;
  padding: 8px 10px;
  border-left: 3px solid #e0a94f;
  background: #fff9ee;
  color: #8a5a12;
  font-size: 12px;
}

.order-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}

.order-meta .label { color: var(--muted); margin-right: 6px; }

.fee-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

.fee-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.fee-card h4 {
  margin: 0;
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: #46536a;
}

.fee-list { padding: 6px 14px 10px; }

.fee-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed #eef0f4;
  font-size: 13px;
}

.fee-item:last-child { border-bottom: 0; }
.fee-item .label { color: var(--muted); }
.fee-item .value { font-weight: 600; text-align: right; word-break: break-all; }
.fee-item .value.positive { color: var(--ok); }

.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty .big { font-size: 30px; margin-bottom: 8px; }

details.raw { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
details.raw summary { cursor: pointer; color: var(--primary); font-size: 13px; }

.raw-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 12px; }
.raw-table th, .raw-table td { border: 1px solid var(--border); padding: 6px 9px; text-align: left; vertical-align: top; }
.raw-table th { background: #f8fafc; color: #46536a; white-space: nowrap; }
.raw-table td { word-break: break-all; max-width: 320px; }

/* ---------- 状态汇总 ---------- */
.sync-info {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.sync-info.pending { background: #fff8e6; border-color: #f5d98a; color: #8a6d1f; }
.summary-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 1500px; }
.summary-table th, .summary-table td { padding: 8px 10px; }
.summary-table thead th { position: sticky; top: 0; z-index: 1; }
.summary-table th, .summary-table td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
}
.summary-table th { background: #f8fafc; color: #46536a; font-weight: 600; text-align: center; }
.summary-table td:first-child, .summary-table th:first-child { text-align: left; }
.summary-table tbody tr:hover { background: #fafcff; }
.summary-table .total-row { background: var(--soft-blue); font-weight: 700; }
.summary-table .total-row td { border-top: 2px solid var(--primary); }
.summary-table .zero { color: #b6bdc9; }
.summary-wrap { overflow-x: auto; }
/* 报表容器：占满剩余高度，表头吸顶 + 底部汇总行吸底，中间数据区滚动 */
.report-scroll { flex: 1; min-height: 180px; overflow: auto; overflow-anchor: none; }
/* 折叠按钮：与查询行同行，推到最右，小字体 */
.fold-toggle {
  margin-left: auto; height: 36px; padding: 0 12px; font-size: 11px;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--primary); cursor: pointer;
}
.fold-toggle:hover { border-color: var(--primary); background: var(--soft-blue); }
.summary-note { margin-top: 12px; font-size: 12px; color: var(--muted); }

/* ---------- 同步数据页 ---------- */
.sync-filter {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 14px;
  border: 1px solid var(--border); border-radius: 10px; background: #f8fafc;
}
.sync-filter label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #46536a; }
.sync-filter select, .sync-filter input[type="date"] {
  height: 34px; padding: 0 9px; border: 1px solid var(--border); border-radius: 7px;
  background: #fff; color: var(--text); font-size: 12px; outline: none;
}
.sync-filter select { min-width: 150px; max-width: 220px; }
.sync-filter select:focus, .sync-filter input:focus { border-color: var(--primary); }
.sync-filter .tilde { color: var(--muted); }
.sync-filter .button { height: 34px; padding: 0 12px; font-size: 12px; }
.sync-scope-tip { margin-left: auto; font-size: 11px; color: var(--muted); }

.sync-overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 4px 0 18px; }
.sync-overview-item {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: #f8fafc; display: flex; flex-direction: column; gap: 4px;
}
.sync-overview-item span { font-size: 12px; color: var(--muted); }
.sync-overview-item strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.sync-overview-item strong.sync-time { font-size: 14px; line-height: 1.8; }
.sync-log-head { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 10px; }
.sync-log-head h4 { margin: 0; font-size: 14px; font-weight: 600; }
.sync-log-tip { font-size: 12px; color: var(--muted); }
.sync-log-list { display: flex; flex-direction: column; gap: 8px; }
.sync-log-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
}
.sync-log-item.failed { border-color: #f0c9c4; background: #fff8f7; }
.sync-log-index {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--soft-blue); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}
.sync-log-item.failed .sync-log-index { background: #fdecea; color: var(--error); }
.sync-log-main { flex: 1; min-width: 0; }
.sync-log-line1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.sync-log-status {
  padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
  background: #e7f5ee; color: var(--ok);
}
.sync-log-item.failed .sync-log-status { background: #fdecea; color: var(--error); }
.sync-log-time { font-size: 13px; font-weight: 600; }
.sync-log-meta { font-size: 12px; color: var(--muted); }
.sync-log-message { font-size: 12px; color: #46536a; line-height: 1.6; word-break: break-all; }

/* ---------- 订单报表 ---------- */
/* 报表平台切换 Tab：放在报表顶部，切换后筛选与数据同步刷新 */
.platform-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: 12px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.platform-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  padding: 6px 16px;
  border-radius: 7px;
  cursor: pointer;
}
.platform-tab:hover { color: var(--text); }
.platform-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-row input[type="text"] { width: 150px; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); outline: none; }
.filter-row input[type="date"] { height: 36px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); }
.filter-row select { height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); max-width: 170px; }
.filter-row input:focus, .filter-row select:focus { border-color: var(--primary); }
.filter-row .button { height: 36px; }
.check-filter {
  display: inline-flex; align-items: center; gap: 4px;
  height: 36px; padding: 0 8px; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; color: var(--text); font-size: 12px; cursor: pointer;
  white-space: nowrap;
}
.check-filter input { accent-color: var(--primary); cursor: pointer; }

/* 时间类型 + 日期范围选择组件 */
.time-type-select { min-width: 116px; }
.date-range { position: relative; flex: none; }
.date-range-trigger {
  height: 36px; min-width: 152px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; color: var(--text); font-size: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; white-space: nowrap;
}
.date-range-trigger:hover { border-color: var(--primary); }
.date-range-trigger svg { color: var(--muted); flex: none; }
.date-range-panel {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  width: 320px; padding: 12px; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
}
.date-range.open .date-range-panel { display: block; }
.range-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.range-presets button {
  height: 28px; border: 1px solid var(--border); border-radius: 6px;
  background: #f8fafc; color: var(--text); font-size: 11px; cursor: pointer;
}
.range-presets button:hover { border-color: var(--primary); color: var(--primary); background: var(--soft-blue); }
.range-custom { display: flex; align-items: center; gap: 6px; }
.range-custom input[type="date"] {
  flex: 1; min-width: 0; height: 32px; padding: 0 6px; border: 1px solid var(--border);
  border-radius: 6px; background: #fff; color: var(--text); font-size: 11px;
}
.range-sep { font-size: 11px; color: var(--muted); }
.range-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.range-actions .button { height: 30px; padding: 0 12px; font-size: 11px; }
.query-btn { margin-left: auto; }

.report-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.report-sum-item {
  flex: 1 1 140px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: #f8fafc; display: flex; flex-direction: column; gap: 3px;
}
.report-sum-item span { font-size: 11px; color: var(--muted); }
.report-sum-item strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.report-sum-item strong.positive { color: var(--ok); }

.report-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.report-table th, .report-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; white-space: nowrap; }
.report-table thead th { position: sticky; top: 0; z-index: 4; background: #f8fafc; color: #46536a; font-weight: 600; text-align: center; }
.report-table tbody tr:hover td { background: #fafcff; }
.report-table td .zero { color: #b6bdc9; }
.report-table a { color: var(--primary); }
.row-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 3px; border: 1px solid var(--border); display: block; }
.row-thumb:hover { border-color: var(--primary); }

/* 滚动到最右侧时折叠订单金额左侧的列，让订单金额紧贴冻结区（无动画，避免宽度渐变干扰滚动定位） */
.report-table.folded .fold-col {
  width: 0 !important; min-width: 0 !important; max-width: 0 !important;
  padding-left: 0 !important; padding-right: 0 !important;
  border-left: 0 !important; border-right: 0 !important;
  overflow: hidden; opacity: 0; font-size: 0;
}

/* 折叠后：冻结列保持固定宽度，其余费用列自动平分剩余空间，整表铺满页面且不再横向滚动 */
.report-table.folded {
  width: 100%; min-width: 0; table-layout: fixed;
}
.report-table.folded th:not(.frozen-col):not(.fold-col),
.report-table.folded td:not(.frozen-col):not(.fold-col) {
  width: auto !important; min-width: 0 !important; max-width: none !important;
  overflow: hidden; text-overflow: ellipsis;
}

/* 冻结列：亚马逊订单号 / 仓库状态 / 店铺名称 / ASIN / 图片地址 */
.report-table .frozen-col {
  position: sticky; background: #fff; box-shadow: 1px 0 0 var(--border);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.report-table thead th.frozen-col { z-index: 6; background: #f8fafc; }
.report-table tbody td.frozen-col { z-index: 2; }
.report-table tbody tr:hover td.frozen-col { background: #fafcff; }
.report-table td.frozen-col:last-of-type, .report-table th.frozen-col:last-of-type { box-shadow: 2px 0 4px rgba(31, 39, 51, .1); }

/* 底部固定汇总行 */
.report-table tfoot td {
  position: sticky; bottom: 0; z-index: 3;
  background: var(--soft-blue); font-weight: 600; color: var(--primary);
  border-top: 2px solid var(--primary); text-align: right;
}
.report-table tfoot td.frozen-col { z-index: 7; background: #e4ecff; }
.report-table tfoot td:first-child { text-align: left; }

.pager { display: flex; gap: 4px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.pager button {
  min-width: 32px; height: 30px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text); cursor: pointer; font-size: 12px;
}
.pager button:hover:not(:disabled) { border-color: var(--primary); }
.pager button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager button:disabled { opacity: .45; cursor: not-allowed; }
.pager-jump { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; color: var(--muted); }
.pager-jump input { width: 52px; height: 30px; padding: 0 6px; border: 1px solid var(--border); border-radius: 6px; text-align: center; }

.shop-report-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 12px 0 6px;
}
.shop-report-head h4 { margin: 0; font-size: 14px; font-weight: 600; }
.shop-report-head span { font-size: 11px; color: var(--muted); }
.shop-report-wrap {
  flex: none; max-height: 220px;
  overflow-x: hidden; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px;
}
.shop-summary-table {
  width: 100%; min-width: 0; table-layout: fixed;
  border-collapse: separate; border-spacing: 0;
  font-size: 11px; font-variant-numeric: tabular-nums;
}
.shop-summary-table th, .shop-summary-table td {
  padding: 6px 5px; text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-bottom: 1px solid var(--border); border-right: 1px solid var(--border);
}
.shop-summary-table th {
  position: sticky; top: 0; z-index: 2;
  background: #f8fafc; color: #46536a; font-weight: 600;
  white-space: normal; line-height: 1.25; word-break: break-all;
  vertical-align: middle;
}
.shop-summary-table th:first-child, .shop-summary-table td:first-child { text-align: left; background: #fff; }
.shop-summary-table th:first-child { background: #f8fafc; }
.shop-summary-table tfoot td {
  position: sticky; bottom: 0; z-index: 2;
  background: #f8fafc; font-weight: 600; color: #24324a;
}
.shop-summary-table tbody tr:hover td { background: #fafcff; }
.cell-link {
  border: 0; background: transparent; padding: 0; margin: 0;
  color: var(--primary); font: inherit; cursor: pointer;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cell-link:hover { text-decoration: underline; }
.cell-with-copy {
  display: inline-flex; align-items: center; gap: 4px;
  max-width: 100%; min-width: 0;
}
.cell-with-copy .cell-link { min-width: 0; flex: 0 1 auto; }
.copy-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; padding: 0; margin: 0;
  border: 0; border-radius: 3px; background: transparent;
  color: #94a3b8; cursor: pointer; vertical-align: middle;
}
.copy-btn:hover { color: var(--primary); background: #eef4ff; }

/* 店铺报表列宽：合计 100%，整页铺满，无横向滚动 */
.shop-summary-table:not(.asin-summary-table) th:nth-child(1) { width: 10%; }
.shop-summary-table:not(.asin-summary-table) th:nth-child(2) { width: 5%; }
.shop-summary-table:not(.asin-summary-table) th:nth-child(3) { width: 6%; }
.shop-summary-table:not(.asin-summary-table) th:nth-child(4) { width: 4%; }
.shop-summary-table:not(.asin-summary-table) th:nth-child(5) { width: 6%; }
.shop-summary-table:not(.asin-summary-table) th:nth-child(6) { width: 6%; }
.shop-summary-table:not(.asin-summary-table) th:nth-child(7) { width: 6%; }
.shop-summary-table:not(.asin-summary-table) th:nth-child(8) { width: 8%; }
.shop-summary-table:not(.asin-summary-table) th:nth-child(9) { width: 7%; }
.shop-summary-table:not(.asin-summary-table) th:nth-child(10) { width: 7%; }
.shop-summary-table:not(.asin-summary-table) th:nth-child(11) { width: 7%; }
.shop-summary-table:not(.asin-summary-table) th:nth-child(12) { width: 6%; }
.shop-summary-table:not(.asin-summary-table) th:nth-child(13) { width: 6%; }
.shop-summary-table:not(.asin-summary-table) th:nth-child(14) { width: 6%; }
.shop-summary-table:not(.asin-summary-table) th:nth-child(15) { width: 6%; }
.shop-summary-table:not(.asin-summary-table) th:nth-child(16) { width: 4%; }

/* ASIN 报表列宽：图片和 ASIN 略宽，其余压缩，合计 100% */
.asin-summary-table th:nth-child(1) { width: 5%; }
.asin-summary-table th:nth-child(2) { width: 10%; }
.asin-summary-table th:nth-child(3) { width: 5%; }
.asin-summary-table th:nth-child(4) { width: 6%; }
.asin-summary-table th:nth-child(5) { width: 4%; }
.asin-summary-table th:nth-child(6) { width: 6%; }
.asin-summary-table th:nth-child(7) { width: 6%; }
.asin-summary-table th:nth-child(8) { width: 8%; }
.asin-summary-table th:nth-child(9) { width: 7%; }
.asin-summary-table th:nth-child(10) { width: 7%; }
.asin-summary-table th:nth-child(11) { width: 7%; }
.asin-summary-table th:nth-child(12) { width: 6%; }
.asin-summary-table th:nth-child(13) { width: 6%; }
.asin-summary-table th:nth-child(14) { width: 6%; }
.asin-summary-table th:nth-child(15) { width: 6%; }
.asin-summary-table th:nth-child(16) { width: 5%; }
.asin-summary-table th:first-child, .asin-summary-table td:first-child { text-align: center; }
.asin-summary-table th:nth-child(2), .asin-summary-table td:nth-child(2) { text-align: left; }
.asin-summary-table .asin-thumb { width: 30px; height: 30px; }

/* 亏损行：利润 <= 0，整行淡红背景 + 深红文字 */
.report-table tbody tr.loss-row > td,
.shop-summary-table tbody tr.loss-row > td {
  background: #fff1f0;
  color: #9f1239;
  font-weight: 500;
}
.report-table tbody tr.loss-row:hover > td,
.shop-summary-table tbody tr.loss-row:hover > td {
  background: #ffe0dd;
}
.report-table tbody tr.loss-row > td.frozen-col { background: #fff1f0; }
.report-table tbody tr.loss-row:hover > td.frozen-col { background: #ffe0dd; }
.report-table tbody tr.loss-row > td .zero,
.shop-summary-table tbody tr.loss-row > td .zero { color: #9f1239; }
.shop-summary-table tbody tr.loss-row .cell-link { color: #9f1239; }
.shop-summary-table tbody tr.loss-row .copy-btn { color: #9f1239; }

.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px);
}
.modal-card {
  position: relative;
  width: min(880px, calc(100vw - 40px));
  max-height: calc(100vh - 60px); overflow: auto;
  background: #fff; border-radius: 14px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .25);
  padding: 22px 24px 20px;
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.modal-head h3 { margin: 0; font-size: 18px; color: #24324a; }
.modal-sub { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.modal-close {
  border: 0; background: transparent; padding: 0 4px;
  font-size: 24px; line-height: 1; color: #64748b; cursor: pointer;
}
.modal-close:hover { color: #1f2733; }
.modal-tabs { display: flex; gap: 8px; margin: 16px 0 12px; }
.modal-tabs button {
  border: 1px solid var(--border); background: #fff; color: #46536a;
  border-radius: 6px; padding: 5px 14px; font-size: 12px; cursor: pointer;
}
.modal-tabs button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.trend-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.trend-kpis > div {
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.trend-kpis span { display: block; font-size: 11px; color: var(--muted); }
.trend-kpis strong {
  display: block; margin-top: 4px; font-size: 18px;
  color: #24324a; font-variant-numeric: tabular-nums;
}
.trend-chart {
  height: 280px; border: 1px solid var(--border); border-radius: 8px;
  background: #fbfdff; padding: 8px;
}
.trend-chart svg { width: 100%; height: 100%; display: block; }
.chart-empty {
  height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px;
}
.trend-legend {
  display: flex; align-items: center; gap: 18px;
  margin-top: 10px; font-size: 12px; color: #46536a;
}
.legend-dot {
  display: inline-block; width: 9px; height: 9px;
  border-radius: 50%; margin-right: 6px; vertical-align: middle;
}
.legend-dot.orders { background: #2e8bff; }
.legend-dot.amount { background: #f59e0b; }
.trend-hint { margin-left: auto; color: var(--muted); font-size: 11px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  background: #1f2733;
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 50;
  max-width: 90vw;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--error); }
.toast.ok { background: var(--ok); }

@media (max-width: 760px) {
  .sidebar { width: 64px; }
  .sidebar-head span:last-child, .menu-group, .menu-item span:not(.icon), .sidebar-foot span { display: none; }
  .sidebar-head { padding: 0 19px; }
  .menu-item { justify-content: center; }
  .content { padding: 18px 14px 40px; }
  .topbar { padding: 0 16px; }
}
