/* =============================================================================
   跨境数据中台 · 视觉系统
   -----------------------------------------------------------------------------
   设计取向：暖中性底色 + 深墨色左侧导航 + 单一深蓝主色。
   理由：运营每天要在上面待两小时，冷灰蓝的"后台模板脸"会让表格数字发灰；
   暖白底 + 等宽数字能让金额更清晰，深色导航把浏览区与功能区一刀切开。

   字号：正文 13px（信息密度），KPI 28px，标题 15px
   间距：4px 基准，卡片内边距 18/20，组间距 16
   圆角：卡片 10，控件 8，标签 999
   ========================================================================== */

:root {
  /* 表面 */
  --canvas: #f7f5f2;
  --surface: #ffffff;
  --surface-sunk: #fbfaf8;
  --line: #e6e2da;
  --line-soft: #efece6;

  /* 文字 */
  --ink: #16181d;
  --ink-2: #43474f;
  --muted: #7a7770;
  --faint: #a5a29a;

  /* 主色与语义 */
  --brand: #2547d0;
  --brand-hover: #1c39ab;
  --brand-wash: #eef1fd;
  --up: #c3352b;          /* 涨：红（中国市场惯例） */
  --down: #1c7a51;        /* 跌：绿 */
  --warn: #a35c07;
  --warn-wash: #fdf4e6;
  --danger: #b3261e;
  --danger-wash: #fceeec;
  --ok-wash: #e9f5ee;

  /* 侧栏 */
  --side: #14161c;
  --side-2: #1b1e26;
  --side-ink: #e8e9ed;
  --side-muted: #7d818d;
  --side-line: rgba(255, 255, 255, .07);

  --radius: 10px;
  --shadow-1: 0 1px 2px rgba(22, 24, 29, .04);
  --shadow-2: 0 1px 2px rgba(22, 24, 29, .04), 0 10px 30px -18px rgba(22, 24, 29, .28);
  --ease: cubic-bezier(.2, .7, .3, 1);

  --side-w: 236px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(37, 71, 208, .16); }

/* 细滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #d6d2c9; border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #bfbab0; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================ 骨架 */

.shell { display: flex; min-height: 100vh; }

.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w);
  background: linear-gradient(180deg, var(--side-2), var(--side) 42%);
  border-right: 1px solid rgba(0, 0, 0, .3);
  display: flex; flex-direction: column; z-index: 40;
}
.side::after {
  /* 右侧 1px 高光，让深色块与浅色内容区之间有层次而不是硬切 */
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,.10), transparent 60%);
}

.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, #3b5ce0, #2547d0);
  position: relative; box-shadow: 0 2px 8px -2px rgba(37, 71, 208, .8);
}
.brand-mark::before, .brand-mark::after {
  content: ""; position: absolute; background: rgba(255, 255, 255, .92); border-radius: 1px;
}
.brand-mark::before { left: 7px; top: 7px; width: 5px; height: 12px; }
.brand-mark::after  { left: 14px; top: 12px; width: 5px; height: 7px; opacity: .6; }
.brand-txt strong { display: block; color: var(--side-ink); font-size: 13.5px; font-weight: 650; letter-spacing: .01em; }
.brand-txt span { display: block; color: var(--side-muted); font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; margin-top: 1px; }

.nav { flex: 1; overflow-y: auto; padding: 4px 10px 16px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); background-clip: content-box; }

.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 4px; }
.nav-label {
  display: flex; align-items: center; gap: 8px;
  padding: 0 8px 6px; color: var(--side-muted);
  font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; font-weight: 600;
  cursor: pointer; user-select: none;
  transition: color .15s var(--ease);
}
.nav-label:hover { color: var(--side-ink); }
.nav-label i { font-style: normal; font-family: var(--mono); font-size: 9.5px; opacity: .55; }
.nav-label::after { content: ""; flex: 1; height: 1px; background: var(--side-line); }
.nav-label .caret {
  font-size: 9px; opacity: .6; transition: transform .18s var(--ease);
  letter-spacing: 0; text-transform: none;
}
.nav-items.closed { display: none; }

.nav-item {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 7px 10px 7px 14px; margin: 1px 0; border-radius: 7px;
  color: #b9bcc6; cursor: pointer; font-size: 12.8px; user-select: none;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-item:hover { background: rgba(255, 255, 255, .05); color: var(--side-ink); }
.nav-item.on { background: rgba(255, 255, 255, .085); color: #fff; font-weight: 600; }
.nav-item.on::before {
  content: ""; position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 14px; border-radius: 99px; background: #6c8bff;
  box-shadow: 0 0 10px rgba(108, 139, 255, .7);
}
.nav-item .dot {
  width: 4px; height: 4px; border-radius: 99px; background: currentColor;
  opacity: 0; transition: opacity .15s var(--ease); flex: none;
}
.nav-item:hover .dot { opacity: .45; }
.nav-item.on .dot { opacity: 1; background: #6c8bff; }
.nav-item .cnt {
  margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--side-muted);
  background: rgba(255, 255, 255, .07); border-radius: 99px; padding: 0 6px; line-height: 15px;
}

.side-foot { padding: 12px 16px 14px; border-top: 1px solid var(--side-line); }
.side-foot .stamp { color: var(--side-muted); font-size: 10.5px; font-family: var(--mono); }
.side-foot .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.side-foot button {
  border: 1px solid var(--side-line); background: transparent; color: #a9adb8;
  border-radius: 6px; padding: 4px 10px; font-size: 11.5px; cursor: pointer;
  transition: all .15s var(--ease);
}
.side-foot button:hover { color: #fff; border-color: rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .06); }

/* ============================================================ 主区 */

.main { flex: 1; margin-left: var(--side-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px 13px; background: rgba(247, 245, 242, .88);
  backdrop-filter: blur(10px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.topbar .titles { min-width: 0; }
.topbar h1 { font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; }
.topbar .sub { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.topbar .spacer { flex: 1; }

.seg { display: inline-flex; background: #ebe8e1; border-radius: 8px; padding: 2px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 4px 11px; border-radius: 6px; font-size: 12px; font-family: inherit;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }

.switch { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 30px; height: 17px; border-radius: 99px; background: #d8d4cc; position: relative; cursor: pointer; transition: background .18s var(--ease); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 99px; background: #fff; transition: transform .18s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(13px); }

.btn {
  border: 1px solid transparent; border-radius: 8px; padding: 6px 14px; cursor: pointer;
  font-size: 12.5px; font-family: inherit; font-weight: 550; white-space: nowrap;
  transition: all .15s var(--ease);
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(37,71,208,.3); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--surface); border-color: #d5d0c7; }
.btn-danger { background: transparent; color: var(--danger); border-color: #eccdc9; }
.btn-danger:hover:not(:disabled) { background: var(--danger-wash); }
.btn-sm { padding: 3px 9px; font-size: 11.5px; }
.btn-link { border: 0; background: none; color: var(--brand); padding: 0; font-size: 12px; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

.banner {
  display: none; margin: 14px 26px 0; padding: 9px 14px; border-radius: 9px; font-size: 12px;
  border: 1px solid transparent; line-height: 1.7;
}
.banner.show { display: block; }
.banner.err { background: var(--danger-wash); border-color: #f0cfcb; color: #8e211a; }
.banner.warn { background: var(--warn-wash); border-color: #f0dcba; color: #7d4703; }
.banner b { font-weight: 650; }

.view { padding: 18px 26px 40px; max-width: 1560px; width: 100%; margin-inline: auto; }
.view-enter { animation: viewIn .22s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ============================================================ 卡片与网格 */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1); overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px 12px; border-bottom: 1px solid var(--line-soft);
}
.card-head h2 { font-size: 13.5px; font-weight: 650; letter-spacing: -.005em; }
.card-head .hint { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.card-head .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 4px 6px 6px; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.s2 { grid-template-columns: 3fr 2fr; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); gap: 12px; margin-bottom: 16px; }

.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 13px; box-shadow: var(--shadow-1); position: relative; overflow: hidden;
  transition: box-shadow .18s var(--ease), transform .18s var(--ease);
}
.kpi:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.kpi .label { color: var(--muted); font-size: 11.5px; display: flex; align-items: center; gap: 6px; }
.kpi .val {
  font-family: var(--mono); font-size: 23px; font-weight: 600; letter-spacing: -.03em;
  margin-top: 5px; line-height: 1.15; font-variant-numeric: tabular-nums;
}
.kpi .val small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi .foot { margin-top: 5px; font-size: 11px; color: var(--faint); display: flex; align-items: center; gap: 5px; }
.kpi.accent { background: linear-gradient(160deg, #f3f5ff, #fff 55%); border-color: #dfe4f8; }

.delta { font-family: var(--mono); font-size: 11px; font-weight: 600; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.flat { color: var(--muted); }

.chart { width: 100%; height: 288px; }
.chart.sm { height: 210px; }

/* ============================================================ 表格 */

.table-wrap { overflow: auto; max-height: 620px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-sunk);
  text-align: left; color: var(--muted); font-weight: 600; font-size: 11px;
  letter-spacing: .04em; padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
thead th.num { text-align: right; }
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; color: var(--ink-2); }
tbody td.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
tbody td.strong { color: var(--ink); font-weight: 600; }
tbody tr:hover td { background: #faf8f5; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.dim td { color: var(--faint); }
.currency { color: var(--faint); font-size: 10.5px; font-family: var(--mono); margin-left: 4px; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px;
  border-radius: 99px; font-size: 10.5px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
}
.tag-ok { background: var(--ok-wash); color: #146c43; }
.tag-err { background: var(--danger-wash); color: #94241c; }
.tag-warn { background: var(--warn-wash); color: #8a4d05; }
.tag-info { background: var(--brand-wash); color: #20389f; }
.tag-muted { background: #f1eee9; color: #77736b; }

/* ============================================================ 表单 */

.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 14px; }
.form .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11px; color: var(--muted); letter-spacing: .01em; }
.field > span b { color: var(--danger); font-weight: 600; margin-left: 2px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
  font-size: 12.5px; font-family: inherit; color: var(--ink); background: var(--surface);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: #d9d4cb; }
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 71, 208, .12);
}
input::placeholder { color: var(--faint); }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.form-actions .note { color: var(--faint); font-size: 11px; }

/* ============================================================ 状态 */

.empty { padding: 44px 20px; text-align: center; color: var(--faint); font-size: 12.5px; }
.empty .ico {
  width: 34px; height: 34px; margin: 0 auto 10px; border-radius: 9px;
  border: 1px dashed #d8d3c9; display: flex; align-items: center; justify-content: center;
  color: #c2bdb3; font-family: var(--mono); font-size: 14px;
}
.empty p { max-width: 380px; margin: 0 auto; line-height: 1.75; }
.empty .act { margin-top: 12px; }

.skeleton { padding: 18px; display: grid; gap: 10px; }
.skeleton i {
  display: block; height: 12px; border-radius: 4px;
  background: linear-gradient(90deg, #efebe4, #f7f5f1, #efebe4);
  background-size: 200% 100%; animation: shim 1.1s infinite linear;
}
@keyframes shim { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 99px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================ 子标签 */

.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.subtabs button {
  border: 0; background: none; cursor: pointer; font-family: inherit; font-size: 12.5px;
  color: var(--muted); padding: 7px 13px 9px; position: relative; border-radius: 6px 6px 0 0;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.subtabs button:hover { color: var(--ink); background: #f3f0eb; }
.subtabs button.on { color: var(--brand); font-weight: 620; }
.subtabs button.on::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px;
  background: var(--brand); border-radius: 2px 2px 0 0;
}

/* ============================================================ 模态弹窗（v1.3.2） */

.modal-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start;
  justify-content: center; background: rgba(15, 23, 42, 0.45); padding: 60px 16px 16px;
  overflow-y: auto; }
.modal-box { background: var(--surface, #fff); border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.22);
  width: min(760px, 96vw); max-height: calc(100vh - 90px); display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line, #e5e7eb); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 14px 18px 18px; overflow-y: auto; }

/* ============================================================ 分页条（v1.3） */

.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pager .btn-sm { min-width: 32px; text-align: center; }
.pager .pg-ellipsis { color: var(--faint); padding: 0 2px; }
.pager .pg-info { color: var(--faint); font-size: 11px; margin-left: 6px; }

/* ============================================================ 可搜索下拉（v1.3.1） */

.combo { position: relative; }
.combo-list {
  position: absolute; top: calc(100% - 4px); left: 0; right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(31, 28, 23, .14); max-height: 264px; overflow: auto; padding: 4px;
}
.combo-opt {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  padding: 6px 9px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
.combo-opt:hover { background: #f3f0eb; }
.combo-opt b { font-family: var(--mono); font-weight: 600; }
.combo-opt span { color: var(--faint); font-size: 11px; white-space: nowrap; }
.combo-more { padding: 8px 9px; color: var(--faint); font-size: 11px; }

/* 订单复选框列 */
.ck { width: 30px; text-align: center; }
.ck input { width: auto; margin: 0; }

/* ============================================================ 杂项 */

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 11.5px; }
.tiny { font-size: 10.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.divider { height: 1px; background: var(--line-soft); margin: 14px 0; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.rate-card {
  border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; background: var(--surface-sunk);
  min-width: 132px;
}
.rate-card .code { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .06em; }
.rate-card .v { font-family: var(--mono); font-size: 17px; font-weight: 600; margin-top: 2px; letter-spacing: -.02em; }
.rate-card .d { font-size: 10.5px; color: var(--faint); margin-top: 1px; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 14px);
  z-index: 90; padding: 10px 18px; border-radius: 9px; font-size: 12.5px;
  background: var(--ink); color: #fff; box-shadow: 0 12px 30px -12px rgba(0,0,0,.5);
  opacity: 0; pointer-events: none; transition: all .22s var(--ease); max-width: 78vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #8f201a; }
.toast.ok { background: #14532d; }

/* 登录遮罩 */
.overlay {
  position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center;
  background: rgba(20, 22, 28, .55); backdrop-filter: blur(6px); padding: 20px;
}
.overlay.show { display: flex; }
.overlay .box {
  background: var(--surface); border-radius: 14px; padding: 26px 26px 24px; width: 340px;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .6); animation: viewIn .22s var(--ease);
}
.overlay h2 { font-size: 15px; font-weight: 650; }
.overlay p { color: var(--muted); font-size: 11.5px; margin: 4px 0 16px; line-height: 1.7; }
.overlay .btn { width: 100%; margin-top: 10px; padding: 8px 14px; }

/* 移动端 */
.burger { display: none; }
@media (max-width: 1080px) {
  :root { --side-w: 0px; }
  .side { transform: translateX(-100%); transition: transform .24s var(--ease); width: 236px; }
  .side.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.4); }
  .main { margin-left: 0; }
  .burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
    background: var(--surface); cursor: pointer; font-size: 15px; color: var(--ink-2);
  }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .view { padding: 14px 16px 32px; }
  .banner { margin: 12px 16px 0; }
  .grid.c2, .grid.s2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
}
.scrim { display: none; }
@media (max-width: 1080px) {
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(20,22,28,.45); z-index: 35; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
