/* =========================================================================
   四方聚合支付系统 · 统一设计系统
   风格：深墨蓝控制台 + 翡翠绿(利润) · 财务数字等宽对齐
   仅用于高保真静态 Demo
   ========================================================================= */

/* ---------- 字体：拉丁/数字用 Google Fonts，中文回落系统 PingFang ---------- */
:root {
  --font-display: "Bricolage Grotesque", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-sans: "Manrope", -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  /* ---------- 墨蓝色系（侧边栏 / 深色面板） ---------- */
  --ink-950: #080d1a;
  --ink-900: #0b1120;
  --ink-850: #0f1729;
  --ink-800: #141d33;
  --ink-700: #1d2942;
  --ink-600: #2a3350;

  /* ---------- 画布 / 浅色面板 ---------- */
  --canvas: #eef1f7;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --border: #e3e8f1;
  --border-strong: #d2dae7;

  /* ---------- 文字 ---------- */
  --text: #16203a;
  --text-2: #4a5674;
  --text-3: #8792ab;
  --text-invert: #eaf0fb;
  --text-invert-dim: #9fb0d0;

  /* ---------- 品牌 & 语义色 ---------- */
  --brand: #0fae9a;          /* 翡翠青 · 主品牌 */
  --brand-dark: #0a8a7c;
  --brand-soft: #d8f5ef;
  --profit: #16b364;         /* 利润绿 */
  --profit-soft: #d6f5e3;
  --cost: #6b7ba8;           /* 成本灰蓝 */
  --danger: #f0453a;
  --danger-soft: #fde3e1;
  --warn: #f79009;
  --warn-soft: #fdefd6;
  --info: #2e90fa;
  --info-soft: #dbeafe;
  --gold: #d9a441;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 28, 55, 0.06);
  --shadow: 0 4px 16px rgba(16, 28, 55, 0.08);
  --shadow-lg: 0 18px 48px rgba(11, 17, 32, 0.16);
  --sidebar-w: 244px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--canvas);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.num  { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* =========================================================================
   APP 布局：侧边栏 + 主区
   ========================================================================= */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(15, 174, 154, 0.14), transparent 60%),
    linear-gradient(180deg, var(--ink-900), var(--ink-950));
  color: var(--text-invert);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 20px 20px;
}
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), #0b6f8c);
  box-shadow: 0 6px 18px rgba(15, 174, 154, 0.4);
  flex-shrink: 0;
}
.brand .logo svg { width: 21px; height: 21px; }
.brand .name { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.brand .sub  { font-size: 11px; color: var(--text-invert-dim); letter-spacing: 2px; }

.nav { padding: 6px 12px; overflow-y: auto; flex: 1; }
.nav-group { margin-top: 16px; }
.nav-group > .label {
  font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--text-invert-dim); padding: 6px 12px; opacity: .7;
}
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text-invert-dim); font-size: 13.5px; font-weight: 500;
  margin-bottom: 2px; transition: all .15s ease;
}
.nav a svg { width: 18px; height: 18px; opacity: .85; flex-shrink: 0; }
.nav a:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-invert); }
.nav a.active {
  background: linear-gradient(90deg, rgba(15, 174, 154, 0.22), rgba(15, 174, 154, 0.04));
  color: #fff;
  box-shadow: inset 2px 0 0 var(--brand);
}
.nav a.active svg { opacity: 1; color: var(--brand); }
.nav .tag {
  margin-left: auto; font-size: 10px; padding: 1px 7px; border-radius: 20px;
  background: var(--brand); color: #04211d; font-weight: 700;
}
.sidebar-foot {
  padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex; align-items: center; gap: 10px; font-size: 12px;
}
.sidebar-foot .avatar {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, #2b3a5e, #16233f);
  display: grid; place-items: center; font-weight: 700; color: #cfe; font-size: 13px;
}
.sidebar-foot .who b { display: block; color: var(--text-invert); font-size: 12.5px; }
.sidebar-foot .who span { color: var(--text-invert-dim); font-size: 11px; }

/* ---------- 主区 ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 62px; background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 26px; position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.topbar .crumb { color: var(--text-3); font-size: 12.5px; }
.topbar .spacer { flex: 1; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 7px 12px; width: 260px; color: var(--text-3);
}
.search input { border: none; background: none; outline: none; font-size: 13px; width: 100%; color: var(--text); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); display: grid; place-items: center; color: var(--text-2);
  position: relative; transition: all .15s;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }

.content { padding: 24px 26px 48px; max-width: 1440px; width: 100%; }

/* =========================================================================
   通用组件
   ========================================================================= */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-head .t { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -.3px; }
.page-head .d { color: var(--text-3); font-size: 13px; margin-top: 3px; }
.page-head .actions { display: flex; gap: 10px; }

/* 卡片 */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head .ct { font-weight: 700; font-size: 14.5px; }
.card-head .cd { font-size: 12px; color: var(--text-3); }
.card-body { padding: 18px; }

/* 栅格 */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(1, 1fr); } }

/* 统计卡 */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 18px 16px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.stat .cap { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.stat .cap .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.stat .val { font-family: var(--font-mono); font-size: 27px; font-weight: 700; letter-spacing: -1px; margin-top: 12px; font-variant-numeric: tabular-nums; }
.stat .val small { font-size: 15px; color: var(--text-3); font-weight: 500; }
.stat .foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--text-3); }
.stat.is-profit { background: linear-gradient(180deg, #f2fdf7, #ffffff); border-color: #c7ecd6; }
.stat.is-profit .cap .ic { background: var(--profit-soft); color: var(--profit); }
.stat.is-profit .val { color: var(--profit); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 12px; padding: 1px 7px; border-radius: 20px; }
.delta.up { color: var(--profit); background: var(--profit-soft); }
.delta.down { color: var(--danger); background: var(--danger-soft); }

/* 徽章 / 状态 */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
  white-space: nowrap;
}
.badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--profit); background: var(--profit-soft); border-color: transparent; }
.badge.wait { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge.fail { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge.info { color: var(--info); background: var(--info-soft); border-color: transparent; }
.badge.mute { color: var(--text-3); }
.badge.brand { color: var(--brand-dark); background: var(--brand-soft); border-color: transparent; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: all .15s ease; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(15, 174, 154, .28); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.dark { background: var(--ink-800); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn.danger { color: var(--danger); border-color: var(--danger-soft); }
.btn.danger:hover { background: var(--danger-soft); }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-size: 11.5px; letter-spacing: .4px; text-transform: uppercase;
  color: var(--text-3); font-weight: 700; padding: 11px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
table.tbl tbody tr:last-child td, table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
.t-strong { font-weight: 700; }
.t-dim { color: var(--text-3); }
.money { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.money.pos { color: var(--profit); }
.money.neg { color: var(--danger); }
td .sub { font-size: 11.5px; color: var(--text-3); }
.rowicon { width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; vertical-align: middle; margin-right: 8px; }
.pay-wx { background: #e7f7ec; color: #12b347; }
.pay-ali { background: #e6f1fe; color: #1477ff; }

/* 迷你分段/filter 条 */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button { border: none; background: none; padding: 6px 13px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.seg button.on { background: var(--surface); color: var(--brand-dark); box-shadow: var(--shadow-sm); }
.filter { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 7px 12px; font-size: 13px; color: var(--text-2); }
.filter select, .filter input { border: none; outline: none; background: none; font-size: 13px; color: var(--text); font-family: inherit; }

/* 表单 */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.input, .select {
  width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 10px;
  padding: 0 12px; font-size: 13.5px; color: var(--text); background: var(--surface); outline: none; font-family: inherit;
  transition: border .15s, box-shadow .15s;
}
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 174, 154, .14); }
.input-group { display: flex; align-items: stretch; gap: 0; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .btn { border-radius: 0 10px 10px 0; border-left: none; }

/* 进度条 */
.bar { height: 7px; border-radius: 20px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--brand), var(--profit)); }

/* 分隔 & 杂项 */
.hr { height: 1px; background: var(--border); border: none; margin: 16px 0; }
.kv { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-3); }
.kv .v { font-weight: 600; }
.muted { color: var(--text-3); }
.pill-note { display: inline-flex; gap: 7px; align-items: center; font-size: 12px; color: var(--warn); background: var(--warn-soft); padding: 6px 11px; border-radius: 9px; }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: space-between; padding: 14px 4px 0; font-size: 13px; color: var(--text-3); }
.pager .pages { display: flex; gap: 5px; }
.pager .pages button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; }
.pager .pages button.on { background: var(--ink-800); color: #fff; border-color: transparent; }

/* 时间轴 */
.flow { position: relative; padding-left: 26px; }
.flow::before { content: ""; position: absolute; left: 9px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.flow .step { position: relative; padding-bottom: 20px; }
.flow .step:last-child { padding-bottom: 0; }
.flow .step .dot { position: absolute; left: -22px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--border-strong); }
.flow .step.done .dot { border-color: var(--profit); background: var(--profit); }
.flow .step.active .dot { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.flow .step .st { font-weight: 700; font-size: 13.5px; }
.flow .step .sd { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Toast */
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--ink-800); color: #fff; padding: 12px 16px; border-radius: 11px;
  box-shadow: var(--shadow-lg); font-size: 13.5px; display: flex; align-items: center; gap: 10px;
  animation: toastIn .3s cubic-bezier(.2,.8,.3,1);
}
.toast .ic { color: var(--profit); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* 页面载入动画 */
.reveal { opacity: 0; transform: translateY(10px); animation: reveal .5s cubic-bezier(.2,.8,.3,1) forwards; }
@keyframes reveal { to { opacity: 1; transform: none; } }
.d1 { animation-delay: .04s; } .d2 { animation-delay: .08s; } .d3 { animation-delay: .12s; }
.d4 { animation-delay: .16s; } .d5 { animation-delay: .2s; } .d6 { animation-delay: .24s; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c9d3e3; border-radius: 20px; border: 3px solid var(--canvas); }
.sidebar ::-webkit-scrollbar-thumb { background: #2a3654; border-color: transparent; }

/* 响应式：窄屏折叠侧栏 */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .search { display: none; }
  .content { padding: 16px; }
}
