/* ==========================================================================
   集团资金管理台账 V1.0 · 网页演示版
   设计取向：明亮的财务工作台，深色仅用于小面积强调与代码块。
   ========================================================================== */

:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-alt: #fafbfd;
  --surface-sunken: #f6f8fb;
  --line: #e3e9f1;
  --line-soft: #edf1f6;
  --line-strong: #cfd9e6;

  --text: #101f33;
  --text-2: #43546b;
  --muted: #6b7c93;
  --faint: #93a1b3;

  --navy: #14304c;
  --navy-600: #1d4468;
  --navy-100: #e8eff6;
  --teal: #0f766e;
  --teal-100: #e4f3f0;
  --gold: #a6751c;
  --gold-100: #fdf4e0;
  --danger: #b42318;
  --danger-100: #fdecea;
  --warn: #b54708;
  --warn-100: #fdf1e6;
  --ok: #067647;
  --ok-100: #e7f6ee;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 2px rgba(16, 31, 51, 0.05), 0 1px 3px rgba(16, 31, 51, 0.04);
  --shadow-2: 0 18px 44px rgba(16, 31, 51, 0.16);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", "Roboto Mono", Consolas,
    "Liberation Mono", monospace;

  --sidebar-w: 234px;
  --banner-h: 36px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-600); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: #cfe3f5; }

:focus-visible {
  outline: 2px solid #2a6da8;
  outline-offset: 2px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   演示横幅
   -------------------------------------------------------------------------- */
.demo-banner {
  height: var(--banner-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: #fff6e3;
  border-bottom: 1px solid #efdcb2;
  color: #6f4a06;
  font-size: 12px;
  letter-spacing: 0.1px;
  position: sticky;
  top: 0;
  z-index: 60;
}
.demo-banner strong { font-weight: 700; }
.demo-banner .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #d28b12;
  box-shadow: 0 0 0 0 rgba(210, 139, 18, 0.5);
  animation: pulse 2.4s infinite;
  flex: none;
}
.demo-banner .sep { color: #d6bd8c; }
.demo-banner .grow { flex: 1; }
.demo-banner a { color: #6f4a06; text-decoration: underline; text-underline-offset: 2px; }
.banner-short { display: none; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(210, 139, 18, 0.45); }
  70% { box-shadow: 0 0 0 6px rgba(210, 139, 18, 0); }
  100% { box-shadow: 0 0 0 0 rgba(210, 139, 18, 0); }
}

/* --------------------------------------------------------------------------
   骨架
   -------------------------------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: calc(100vh - var(--banner-h));
}

/* ---------------------------- 侧栏 ---------------------------- */
.sidebar {
  background: #fbfcfe;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.brand .mark {
  display: flex; align-items: center; gap: 10px;
}
.brand .mark svg { flex: none; }
.brand .title {
  font-size: 13.5px; font-weight: 700; letter-spacing: 0.2px; color: var(--navy);
  line-height: 1.35;
}
.brand .sub {
  font-size: 11px; color: var(--faint); margin-top: 4px; letter-spacing: 0.4px;
}
.brand .env {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 9px; padding: 2px 7px;
  border: 1px solid #efdcb2; background: #fff8ea; color: #7a5209;
  border-radius: 999px; font-size: 10.5px; letter-spacing: 0.4px;
}

.nav { padding: 10px 10px 4px; overflow-y: auto; flex: 1; min-height: 0; }
.nav-group { margin-top: 10px; }
.nav-group-label {
  font-size: 10.5px; letter-spacing: 1.2px; color: var(--faint);
  text-transform: uppercase; padding: 6px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13px;
  cursor: pointer; user-select: none;
  border: 1px solid transparent;
  transition: background 0.14s, color 0.14s;
}
.nav-item svg { flex: none; opacity: 0.75; }
.nav-item:hover { background: #eef3f9; color: var(--navy); text-decoration: none; }
.nav-item.active {
  background: var(--navy); color: #fff; border-color: var(--navy);
  box-shadow: 0 2px 6px rgba(20, 48, 76, 0.18);
}
.nav-item.active svg { opacity: 1; }
.nav-item .count {
  margin-left: auto; font-size: 11px; color: var(--muted);
  background: #eef2f7; border-radius: 999px; padding: 0 6px; line-height: 17px;
}
.nav-item.active .count { background: rgba(255, 255, 255, 0.18); color: #fff; }
.nav-item.hidden { display: none; }

.sidebar-foot {
  border-top: 1px solid var(--line-soft);
  padding: 12px 16px 14px;
  font-size: 11px; color: var(--faint); line-height: 1.7;
}
.sidebar-foot .k { color: var(--text-2); }

/* ---------------------------- 主区 ---------------------------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  height: 58px; flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  z-index: 20;
}
.topbar .crumb { font-size: 12px; color: var(--faint); }
.topbar .crumb b { color: var(--text-2); font-weight: 600; }
.topbar .grow { flex: 1; }

.role-switch { display: flex; align-items: center; gap: 8px; }
.role-switch .label { font-size: 11px; color: var(--faint); }

.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: #eef2f7; border-radius: 10px;
}
.seg button {
  border: 0; background: transparent; cursor: pointer;
  padding: 5px 11px; border-radius: 7px;
  font-size: 12.5px; color: var(--muted); white-space: nowrap;
  transition: background 0.14s, color 0.14s;
}
.seg button:hover { color: var(--navy); }
.seg button.on {
  background: #fff; color: var(--navy); font-weight: 600;
  box-shadow: var(--shadow-1);
}

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 9px 4px 5px; border: 1px solid var(--line);
  border-radius: 999px; background: #fff; font-size: 12px;
}
.avatar {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--navy-100); color: var(--navy);
  font-size: 11px; font-weight: 700;
}
.user-chip .meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-chip .meta b { font-size: 12px; font-weight: 600; color: var(--text); }
.user-chip .meta span {
  font-size: 10px; color: var(--faint);
  max-width: 268px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--navy); }

.view {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 22px 24px 56px;
  scroll-behavior: smooth;
}
.view-inner { max-width: 1400px; margin: 0 auto; animation: fade-up 0.22s ease-out; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   页头 / 工具条
   -------------------------------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.page-head .grow { flex: 1; }
.page-title { font-size: 19px; font-weight: 700; letter-spacing: 0.2px; margin: 0 0 3px; color: var(--navy); }
.page-desc { font-size: 12.5px; color: var(--muted); margin: 0; max-width: 900px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 14px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.toolbar .grow { flex: 1; }
.toolbar .field { display: flex; align-items: center; gap: 6px; }
.toolbar .field > label { font-size: 11.5px; color: var(--faint); white-space: nowrap; }

select, input[type="text"], input[type="date"], input[type="number"], textarea {
  height: 32px; padding: 0 9px;
  border: 1px solid var(--line-strong); border-radius: 7px;
  background: #fff; color: var(--text); font-size: 12.5px;
  transition: border-color 0.14s, box-shadow 0.14s;
}
textarea { height: auto; padding: 8px 9px; line-height: 1.6; resize: vertical; min-height: 72px; }
select:hover, input:hover, textarea:hover { border-color: #b9c6d6; }
select:focus, input:focus, textarea:focus {
  outline: none; border-color: #2a6da8;
  box-shadow: 0 0 0 3px rgba(42, 109, 168, 0.12);
}
input[readonly] { background: var(--surface-sunken); color: var(--text-2); }
.search { position: relative; }
.search input { padding-left: 28px; width: 240px; }
.search svg { position: absolute; left: 8px; top: 8px; opacity: 0.5; }

/* --------------------------------------------------------------------------
   按钮
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 13px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; color: var(--text-2);
  font-size: 12.5px; cursor: pointer; white-space: nowrap;
  transition: background 0.14s, border-color 0.14s, color 0.14s, transform 0.06s;
}
.btn:hover { border-color: #b3c2d4; color: var(--navy); background: #fbfcfe; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-600); border-color: var(--navy-600); color: #fff; }
.btn-teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-teal:hover { background: #0b6459; border-color: #0b6459; color: #fff; }
.btn-danger { border-color: #e7bdb8; color: var(--danger); background: #fff; }
.btn-danger:hover { background: var(--danger-100); border-color: #d99a93; color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--navy-600); }
.btn-ghost:hover { background: #eef3f9; }
.btn-sm { height: 26px; padding: 0 9px; font-size: 11.5px; border-radius: 6px; }
.btn-block { width: 100%; }

/* --------------------------------------------------------------------------
   标签 / 状态
   -------------------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 8px; border-radius: 999px;
  font-size: 11px; line-height: 18px; white-space: nowrap;
  border: 1px solid transparent;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }
.pill-ok { background: var(--ok-100); color: var(--ok); border-color: #c7ead8; }
.pill-warn { background: var(--warn-100); color: var(--warn); border-color: #f3dcc6; }
.pill-danger { background: var(--danger-100); color: var(--danger); border-color: #f3cfca; }
.pill-info { background: var(--navy-100); color: var(--navy-600); border-color: #d5e4f1; }
.pill-muted { background: #f1f4f8; color: var(--muted); border-color: #e5eaf1; }
.pill-gold { background: var(--gold-100); color: var(--gold); border-color: #efdfb9; }
.pill-teal { background: var(--teal-100); color: var(--teal); border-color: #cbe7e2; }

.tag-demo {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 5px;
  background: #fff5df; border: 1px solid #efd9a4; color: #7a4a00;
  font-size: 10.5px; letter-spacing: 0.3px; white-space: nowrap;
}
.tag-api {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 5px;
  background: #eaf4ef; border: 1px solid #c4e3d4; color: #0a6b48;
  font-size: 10.5px; white-space: nowrap;
}

.chip-cur {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 6px;
  background: #f2f5f9; border: 1px solid var(--line);
  font-size: 11px; color: var(--text-2); font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   卡片
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1); min-width: 0;
}
.card + .card { margin-top: 14px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line-soft);
}
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--navy); }
.card-head .sub { font-size: 11.5px; color: var(--faint); }
.card-head .grow { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* --------------------------------------------------------------------------
   首页：币种分栏
   -------------------------------------------------------------------------- */
.currency-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 14px; }
.currency-col {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1); overflow: hidden; min-width: 0;
  display: flex; flex-direction: column;
}
.currency-col header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 15px; border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #fbfcfe, #fff);
}
.currency-col header .sym {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--navy-100); color: var(--navy);
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
}
.currency-col header .name { font-size: 13px; font-weight: 700; color: var(--navy); line-height: 1.2; }
.currency-col header .name small { display: block; font-size: 10.5px; color: var(--faint); font-weight: 400; letter-spacing: 0.4px; }
.currency-col header .grow { flex: 1; }

.currency-body { padding: 14px 15px 15px; }
.balance-label { font-size: 11px; color: var(--faint); letter-spacing: 0.4px; }
.balance-value {
  font-size: 23px; font-weight: 700; color: var(--navy);
  font-variant-numeric: tabular-nums; letter-spacing: -0.4px;
  line-height: 1.25; word-break: break-all;
}
.balance-value .sym { font-size: 14px; color: var(--muted); margin-right: 2px; font-weight: 600; }

.mini-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.mini-metric {
  border: 1px solid var(--line-soft); border-radius: 9px;
  padding: 8px 10px; background: var(--surface-alt);
}
.mini-metric .k { font-size: 10.5px; color: var(--faint); display: flex; align-items: center; gap: 4px; }
.mini-metric .v {
  font-size: 13.5px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; margin-top: 2px; word-break: break-all;
}
.mini-metric.receivable .v { color: var(--teal); }
.mini-metric.payable .v { color: var(--warn); }

.cur-foot {
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line);
  font-size: 10.5px; color: var(--faint); display: flex; justify-content: space-between; gap: 8px;
}

/* 账户页：按币种汇总条 */
.total-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.total-cell { padding: 13px 18px; border-left: 1px solid var(--line-soft); }
.total-cell:first-child { border-left: 0; }
.total-cell .k { font-size: 11px; color: var(--muted); letter-spacing: 0.2px; }
.total-cell .v {
  margin-top: 3px; font-size: 17px; font-weight: 700; color: var(--navy);
  font-variant-numeric: tabular-nums; letter-spacing: -0.2px; word-break: break-all;
}

/* 口径说明卡（币种少于 3 个时补位） */
.rule-card { background: linear-gradient(180deg, #fbfcfe, #f7f9fc); border-style: dashed; }
.rule-card .sym { background: #eef2f7; color: var(--muted); font-family: var(--font-sans); font-style: italic; }
.rule-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px dashed var(--line-soft); font-size: 11.5px;
}
.rule-row:last-child { border-bottom: 0; }
.rule-row .rk { color: var(--faint); flex: none; }
.rule-row .rv { color: var(--text-2); text-align: right; }

/* 指标条 */
.metric-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.metric-row .k { font-size: 12px; color: var(--muted); width: 68px; flex: none; }
.metric-row .bar { flex: 1; }
.metric-row .v { font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; min-width: 90px; text-align: right; }

/* --------------------------------------------------------------------------
   表格
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.table {
  width: 100%; border-collapse: collapse; font-size: 12.5px;
}
table.table th {
  text-align: left; font-weight: 600; color: var(--muted);
  font-size: 11px; letter-spacing: 0.4px;
  background: var(--surface-alt);
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.table td {
  padding: 10px 12px; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover td { background: #fafcff; }
table.table tr.clickable { cursor: pointer; }
table.table .num {
  text-align: right; font-variant-numeric: tabular-nums;
  white-space: nowrap; font-feature-settings: "tnum";
}
table.table .num.strong { font-weight: 700; color: var(--navy); }
table.table .no { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
table.table .muted { color: var(--muted); }
/* V2.3.15 货款明细：说明/备注与供应商都单行省略，悬停看全文。
   加这两列后表格正好铺满内容区，供应商名不允许竖排换行（否则一行字变三行）。 */
table.table .cell-note {
  max-width: 176px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; color: var(--text-2);
}
/* 供应商与货款页：列多（货款明细 12 列），单元格左右留白收紧 4px，
   整表正好铺满内容区不出现横向滚动；其余页面仍用默认 12px。 */
#sup-body table.table th, #sup-body table.table td { padding-left: 8px; padding-right: 8px; }
table.table .cell-date { white-space: nowrap; }
/* V2.3.27 转账备注可编辑：文本单行省略、右侧常驻「改」按钮（空备注也能补），
   备注写错能改，但金额/账户/日期仍不可改（改错走冲正）。
   V2.3.28：整行改 inline-flex，宽度按「文字 + 按钮」自然收口，
   不再用 flex:1 把「改」按钮推到列最右侧（那是"备注和按钮隔一截空白"的根因）。 */
table.table .cell-remark { min-width: 0; max-width: 240px; }
table.table .cell-remark .remark-line {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%; vertical-align: middle;
}
table.table .cell-remark .remark-text {
  flex: 0 1 auto; min-width: 0; max-width: 172px;
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; color: var(--text-2);
}
table.table .cell-remark .remark-text.is-empty {
  color: var(--faint); font-style: italic;
}
table.table .cell-remark .remark-edit {
  flex: none; padding: 2px 8px; font-size: 11px;
}
/* V2.3.28 备注就地气泡：点「改」在单元格旁弹出小卡片，不遮全屏、不打断看单。
   箭头由 ::before 旋转 45° 拼出，位置随弹层上下翻转（pop-up / pop-down）。 */
.remark-pop {
  position: fixed; z-index: 72; width: 316px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 10px; box-shadow: var(--shadow-2);
  padding: 12px 12px 10px;
}
.remark-pop::before {
  content: ""; position: absolute; width: 9px; height: 9px;
  left: var(--arrow-x, 50%);
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  border-top: 1px solid var(--line-strong);
  transform: rotate(45deg);
}
.remark-pop.pop-up::before { top: -5.5px; }
.remark-pop.pop-down::before { bottom: -5.5px; transform: rotate(225deg); }
.remark-pop .remark-pop-head {
  display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px;
}
.remark-pop .remark-pop-head b { font-size: 12.5px; color: var(--text); font-weight: 600; }
.remark-pop .remark-pop-head span {
  font-size: 11px; color: var(--faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.remark-pop textarea {
  width: 100%; min-height: 78px; max-height: 190px; padding: 7px 9px;
  font-size: 12.5px; line-height: 1.6;
}
.remark-pop .remark-pop-msg {
  min-height: 16px; margin-top: 5px; font-size: 11.5px; color: var(--danger);
}
.remark-pop .remark-pop-foot {
  display: flex; align-items: center; gap: 6px; margin-top: 2px;
}
.remark-pop .remark-pop-foot .hint {
  font-size: 11px; color: var(--faint); white-space: nowrap;
}
table.table .cell-sup {
  min-width: 108px; max-width: 132px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
table.table .actions { text-align: right; white-space: nowrap; }
table.table tr.is-reversed td { background: #fffaf7; }
table.table tr.is-reversed:hover td { background: #fff5ee; }

.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 11px; color: var(--faint); margin-top: 1px; }

.table-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-top: 1px solid var(--line-soft);
  font-size: 11.5px; color: var(--faint);
}
.table-foot .grow { flex: 1; }

.empty {
  padding: 44px 20px; text-align: center; color: var(--faint); font-size: 12.5px;
}
.empty .big { font-size: 14px; color: var(--text-2); margin-bottom: 4px; }

/* 金额方向 */
.amt-in { color: var(--teal); font-variant-numeric: tabular-nums; font-weight: 600; }
.amt-out { color: var(--warn); font-variant-numeric: tabular-nums; font-weight: 600; }
.amt-neutral { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   首页其他区块
   -------------------------------------------------------------------------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--line-soft);
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: #fafcff; }
.list-item .main { min-width: 0; flex: 1; }
.list-item .title { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .sub { font-size: 11px; color: var(--faint); margin-top: 1px; }
.list-item .right { text-align: right; flex: none; }

.stack-8 { display: flex; flex-direction: column; gap: 8px; }
.stack-12 { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt-14 { margin-top: 14px; }
.mt-8 { margin-top: 8px; }

.bar { height: 6px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--teal); transition: width 0.4s; }
.bar.warn > span { background: #e39a5c; }
.bar.navy > span { background: var(--navy-600); }

/* 账户分布 */
.dist-row { display: grid; grid-template-columns: 84px 1fr 110px; gap: 10px; align-items: center; padding: 6px 0; }
.dist-row .k { font-size: 11.5px; color: var(--muted); }
.dist-row .v { font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

/* --------------------------------------------------------------------------
   抽屉 / 弹层
   -------------------------------------------------------------------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(16, 31, 51, 0.34);
  opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 80;
}
.overlay.on { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw);
  background: #fff; z-index: 90; display: flex; flex-direction: column;
  transform: translateX(102%); transition: transform 0.24s cubic-bezier(0.22, 0.61, 0.36, 1);
  box-shadow: var(--shadow-2);
}
.drawer.on { transform: none; }
.drawer-head {
  padding: 15px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 12px;
}
.drawer-head .grow { flex: 1; }
.drawer-head h3 { margin: 0; font-size: 15px; color: var(--navy); }
.drawer-head .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }
.drawer-foot {
  padding: 12px 18px; border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-alt);
}

.modal {
  position: fixed; z-index: 95; left: 50%; top: 50%;
  transform: translate(-50%, -48%) scale(0.98);
  width: min(640px, 94vw); max-height: 88vh;
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-2);
  display: none; flex-direction: column; overflow: hidden;
}
.modal.on { display: flex; animation: modal-in 0.18s ease-out forwards; }
@keyframes modal-in {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.98); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.modal-head {
  padding: 15px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.modal-head .grow { flex: 1; }
.modal-head h3 { margin: 0; font-size: 15px; color: var(--navy); }
.modal-head .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 12px 18px; border-top: 1px solid var(--line);
  display: flex; gap: 8px; align-items: center; background: var(--surface-alt);
}
.modal-foot .grow { flex: 1; }

/* --------------------------------------------------------------------------
   表单 / 详情
   -------------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field-block { display: flex; flex-direction: column; gap: 5px; }
.field-block > label { font-size: 11.5px; color: var(--muted); }
.field-block > label .req { color: var(--danger); margin-left: 2px; }
.field-block input, .field-block select, .field-block textarea { width: 100%; }
.field-hint { font-size: 10.5px; color: var(--faint); }
.field-error { font-size: 10.5px; color: var(--danger); }
.field-block.has-error > label { color: var(--danger); }
.field-block.has-error input,
.field-block.has-error select,
.field-block.has-error textarea {
  border-color: #d99a93;
  background: #fffafa;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.06);
}
.counter { font-size: 10.5px; color: var(--faint); text-align: right; }

.kv { display: grid; grid-template-columns: 108px 1fr; gap: 8px 14px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }
.kv dd.num { font-variant-numeric: tabular-nums; font-weight: 600; }

.section-title {
  font-size: 11px; letter-spacing: 0.6px; color: var(--faint);
  text-transform: uppercase; margin: 20px 0 8px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.section-title:first-child { margin-top: 0; }

.amount-hero {
  background: var(--surface-alt); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 14px 16px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.amount-hero .k { font-size: 11px; color: var(--faint); }
.amount-hero .v { font-size: 22px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }

.notice {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 10px 12px; border-radius: 9px;
  background: #fff8e8; border: 1px solid #f0dfb8; color: #6f4a06;
  font-size: 11.5px; line-height: 1.65;
}
.notice svg { flex: none; margin-top: 2px; opacity: 0.8; }
.notice.info { background: #eef4fb; border-color: #d5e4f1; color: #1d4468; }
.notice.danger { background: var(--danger-100); border-color: #f3cfca; color: #8f1c12; }
.notice.ok { background: var(--ok-100); border-color: #c7ead8; color: #05603a; }
.notice b { font-weight: 700; }

.code {
  font-family: var(--font-mono); font-size: 11px; line-height: 1.7;
  background: #f7f9fc; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; color: #22384f;
  white-space: pre-wrap; word-break: break-all; overflow-x: auto;
}
.code .k { color: #7a4a00; }
.code .s { color: #0a6b48; }
.code .c { color: var(--faint); }

/* 确认步骤 */
.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.step {
  flex: 1; padding: 7px 8px 6px; border-top: 2px solid var(--line);
  font-size: 11px; color: var(--faint);
}
.step b { display: block; font-size: 10px; letter-spacing: 0.6px; color: var(--faint); font-weight: 600; }
.step.on { border-color: var(--navy); color: var(--navy); }
.step.on b { color: var(--navy); }
.step.done { border-color: var(--teal); color: var(--teal); }
.step.done b { color: var(--teal); }

/* 时间线 */
.timeline { position: relative; padding-left: 18px; }
.timeline::before {
  content: ""; position: absolute; left: 4px; top: 4px; bottom: 4px;
  width: 1px; background: var(--line);
}
.timeline-item { position: relative; padding: 0 0 14px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ""; position: absolute; left: -18px; top: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: #fff; border: 2px solid var(--line-strong);
}
.timeline-item.accent::before { border-color: var(--teal); background: var(--teal); }
.timeline-item .t { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.timeline-item .d { font-size: 12.5px; color: var(--text); margin-top: 1px; }
.timeline-item .r { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* 冲正关系 */
.relation {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px; background: var(--surface-alt);
  border: 1px dashed var(--line-strong); border-radius: 10px;
}
.relation .node {
  padding: 7px 10px; border-radius: 8px; background: #fff;
  border: 1px solid var(--line); font-size: 11.5px; min-width: 0;
}
.relation .node b { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--navy); }
.relation .node span { color: var(--faint); font-size: 10.5px; }
.relation .arrow { color: var(--faint); }
.relation .node.rev { border-color: #f3cfca; background: #fff8f6; }

/* 权限页 / 覆盖清单 */
.coverage-row td { vertical-align: top; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.legend .item { display: flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; }

.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; }

/* Toast */
#toast-wrap {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: #14304c; color: #fff; font-size: 12px;
  padding: 9px 14px; border-radius: 8px; box-shadow: var(--shadow-2);
  display: flex; align-items: center; gap: 8px;
  animation: toast-in 0.2s ease-out;
  max-width: 90vw;
}
.toast .tag { color: #ffd88a; font-weight: 600; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* 打印 */
@media print {
  .sidebar, .topbar, .demo-banner, .page-actions, .toolbar, .overlay { display: none !important; }
  .app { display: block; height: auto; }
  .view { padding: 0; overflow: visible; }
}

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .currency-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    height: auto; min-height: calc(100vh - var(--banner-h));
  }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); min-width: 0; overflow: hidden; }
  .brand { padding: 12px 14px 8px; }
  /* 原来是单行横向滚动：16 项远超屏宽，Windows 滚动条默认隐藏，
     「收付款 / 冲正」「资金流水」这类靠后的项用户根本看不到、点不到。
     改为换行铺满，所有项常驻可见。 */
  .nav { display: flex; flex-wrap: wrap; gap: 4px; overflow-x: visible; padding: 4px 10px 10px; min-width: 0; max-width: 100%; }
  .nav-group { margin: 0; display: contents; }
  .nav-group-label { display: none; }
  .nav-item { white-space: nowrap; padding: 7px 10px; }
  .nav-item .count { display: none; }
  .sidebar-foot { display: none; }
  .main { min-height: 0; min-width: 0; }
  .view { overflow: visible; padding: 16px 14px 40px; min-width: 0; }
  .topbar { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 8px; min-width: 0; }
  .topbar .crumb { display: none; }
  .role-switch { min-width: 0; max-width: 100%; }
  .seg { min-width: 0; }
  .seg button { min-width: 0; }
}
@media (max-width: 760px) {
  .currency-grid, .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; gap: 10px; }
  /* 注：.page-desc 的 flex-basis 修正写在 unified.css 末尾的窄屏段。
     unified.css 在本文件之后加载，同特异性规则只有写在它后面才生效。 */
  .search input { width: 100%; }
  .kv { grid-template-columns: 92px 1fr; }
  .total-strip { grid-template-columns: 1fr; }
  .total-cell { border-left: 0; border-top: 1px solid var(--line-soft); }
  .total-cell:first-child { border-top: 0; }

  .demo-banner {
    height: auto; min-height: var(--banner-h);
    padding: 6px 12px; flex-wrap: wrap; row-gap: 2px; line-height: 1.45;
  }
  .banner-long, .demo-banner .hide-sm { display: none; }
  .banner-short { display: inline; }
  .demo-banner .grow { display: none; }

  .topbar { row-gap: 8px; }
  .topbar .grow { display: none; }
  .role-switch { flex: 1 1 auto; min-width: 0; }
  .role-switch .label { display: none; }
  .seg { flex: 1; min-width: 0; }
  .seg button { flex: 1 1 0; min-width: 0; padding: 5px 6px; text-align: center; }
  .user-chip { display: none; }
  .view-inner { min-width: 0; }

  .toolbar { gap: 8px 10px; padding: 10px; }
  .toolbar .field { flex: 1 1 160px; min-width: 0; }
  .toolbar .field > label { flex: none; }
  .toolbar select { width: 100%; min-width: 0; }
  .toolbar .search { flex: 1 1 100%; }

  .balance-value { font-size: 20px; }
  .mini-metrics { gap: 8px; }
  .mini-metric .v { font-size: 11.5px; }
  .page-title { font-size: 17px; }
  .card-head { flex-wrap: wrap; row-gap: 6px; }
}

/* ==========================================================================
   联调版（web/）新增：登录屏 + 环境徽标 + 未接通占位
   设计沿用上面的变量与排版，不引入新的色板。
   ========================================================================== */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  background:
    radial-gradient(1100px 520px at 50% -8%, #e6eef7 0%, rgba(230, 238, 247, 0) 62%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 44px -26px rgba(16, 31, 51, 0.34);
  padding: 26px 26px 18px;
}

.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; }
.login-brand .name { font-size: 16px; font-weight: 700; color: var(--navy); letter-spacing: .2px; }
.login-brand .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.login-lead {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.65;
  margin: 14px 0 18px;
  padding: 10px 12px;
  background: var(--surface-sunken);
  border: 1px solid var(--line-soft);
  border-radius: 9px;
}

.login-form { display: flex; flex-direction: column; gap: 13px; }

.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field > label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.login-field input {
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.login-field input:focus {
  border-color: var(--navy-600);
  box-shadow: 0 0 0 3px rgba(29, 68, 104, 0.10);
}
.login-field input[aria-invalid="true"] { border-color: var(--danger); }

.login-error {
  display: none;
  font-size: 12px;
  color: var(--danger);
  background: var(--danger-100);
  border: 1px solid #f3cdc7;
  border-radius: 8px;
  padding: 8px 10px;
  line-height: 1.55;
}
.login-error.show { display: block; }

.login-quick { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.login-quick .cap { font-size: 11px; color: var(--faint); margin-bottom: 7px; }
.login-quick .row { display: flex; gap: 7px; flex-wrap: wrap; }

.login-foot {
  margin-top: 16px;
  font-size: 10.5px;
  color: var(--faint);
  line-height: 1.7;
  border-top: 1px solid var(--line-soft);
  padding-top: 11px;
}

/* 环境徽标：由接口响应头 X-Env 驱动，取不到就不显示 */
.env-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--gold-100);
  color: var(--gold);
  border: 1px solid #f0dcb4;
  white-space: nowrap;
}
.env-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }

/* 未接通占位 */
.pending {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: repeating-linear-gradient(
    135deg, var(--surface-alt) 0 12px, #f7f9fc 12px 24px);
  padding: 26px 24px;
  text-align: left;
}
.pending h3 { margin: 0 0 8px; font-size: 14px; color: var(--navy); }
.pending p { margin: 0 0 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.pending code {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 11.5px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}

.badge-off {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: 1px;
}

/* hidden 属性必须真的隐藏：
   `.login-wrap` / `.app` 都设了 display（grid），而作者样式会覆盖浏览器对
   `[hidden]` 的默认 display:none —— 结果是"设置 hidden 了但还看得见"。
   这条必须放在最后，且用 !important，否则同样的覆盖会再次发生。 */
[hidden] { display: none !important; }

/* ------------------------------------------------------------------
   V2.4.0 跨币种转账 / 付款
   汇率输入带前后缀（「1 CNY =」…「VND」），转入金额只读。
   只在跨币种时出现，同币种界面上这两块是 display:none，不占位。
   ------------------------------------------------------------------ */
.fx-box {
  display: flex; align-items: center; gap: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 10px;
}
.fx-box:focus-within { border-color: var(--navy-600); }
.fx-box input {
  flex: 1; min-width: 0;
  border: 0; background: transparent;
  padding: 9px 2px;
  font-size: 15px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: center; color: var(--text);
}
.fx-box input:focus { outline: none; }
.fx-box input::placeholder { font-weight: 400; font-size: 13px; color: var(--faint); }
.fx-side {
  flex: none; white-space: nowrap;
  font-size: 12px; color: var(--muted);
}
.readonly-amount {
  background: var(--surface-sunken);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  cursor: default;
}
.readonly-amount:focus { outline: none; }
