:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel2: #1c2029;
  --line: #262b36;
  --fg: #e6e9ef;
  --dim: #8b93a7;
  --acc: #4f8cff;
  --ok: #3ddc97;
  --warn: #ffcc66;
  --err: #ff6b6b;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.6 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

#app { display: flex; min-height: 100vh; }

/* ----------------------------- 侧边栏 ----------------------------- */
.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: #12141a;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.brand-title { font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--dim); margin-top: 3px; }
#nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
#nav a {
  color: var(--fg);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid transparent;
}
#nav a:hover { background: #1a1e27; }
#nav a.active { background: #1f2733; border-color: #2c3a52; color: #fff; }
#nav a .ico { width: 18px; text-align: center; }
.badge {
  margin-left: auto;
  background: var(--warn);
  color: #23180a;
  border-radius: 99px;
  font-size: 11px;
  padding: 0 7px;
  font-weight: 700;
}
.sidebar-foot { padding: 12px 14px; border-top: 1px solid var(--line); word-break: break-all; }

/**
 * 导航分组标题。
 *
 * 用来把"一家客户之内的事"和"跨客户的运营"分开 ——
 * 混在一列里会让人搞不清当前视角是"所有客户"还是"某一家"。
 */
.nav-sep {
  margin-top: 12px;
  padding: 6px 14px 4px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--dim);
  text-transform: none;
}

/**
 * **分组标题下面的一句引导。**
 *
 * 为什么需要它：导航里「客户管理 / 账号管理 / 用户管理」三个名字
 * 都带"管理"，用户最常问的就是"我该去哪一页"。
 * 结论放在这里（而不是让你点进去各读一遍再自己总结）。
 *
 * 字号比分组标题还小一档、且不进链接列表 —— 它是**说明**不是入口。
 */
.nav-hint {
  padding: 0 14px 5px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--dim);
  opacity: 0.85;
}

/**
 * 段落里的跳转链接（如「导出交付」→「ERP 导入」的指路）。
 *
 * 用链接样式而不是按钮：它是"去另一个页面看看"，不是提交动作；
 * 做成按钮会让人以为点了会立刻执行什么。
 */
.btn-link {
  color: var(--accent, #6ea8fe);
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
  font-weight: 600;
}
.btn-link:hover { border-bottom-style: solid; }

/* ----------------------------- 顶栏 ----------------------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: #12141a;
  position: sticky;
  top: 0;
  z-index: 5;
  flex-wrap: wrap;
}
.ctx { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ctx label { line-height: 1; }
.actions { display: flex; gap: 8px; }

select, input, button {
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13.5px;
  font-family: inherit;
}
input { width: 104px; }
button { cursor: pointer; }
button.primary { background: var(--acc); border-color: var(--acc); color: #fff; font-weight: 600; }
button.ghost { background: transparent; }
button:hover { border-color: #3a4356; }
button.primary:hover { filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.small { padding: 4px 9px; font-size: 12px; }
button.danger { border-color: #5a2b2b; color: #ffb3b3; }

/**
 * **`.btn` —— 给"长得像按钮、但是 `<a>` 的下载链接"用的。**
 *
 * ⚠ 实测踩到：`装订包` 那个链接写的是 `<a class="btn primary">`，
 * 而**样式表里从来没有 `.btn` 这条规则**（只有 `button.primary`）。
 * 于是它按浏览器默认的 `<a>` 渲染 —— 蓝色、带下划线，在深色底上看起来
 * 像"被划掉/失效的按钮"，而它其实是个能点的下载链接。
 *
 * 为什么下载要用 `<a>` 而不是 `<button>`：那个接口是 **GET + content-disposition**，
 * 用 `<a href download>` 让浏览器自己走下载流程最省事
 * （用 `<button>` 就得再写一段 `location.href = ...`，多一个能写错的地方）。
 * 所以这里给它补上样式，而不是把 `<a>` 换成 `<button>`。
 */
a.btn {
  display: inline-block;
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.2;
  /** ⚠ 必须显式去掉下划线：`<a>` 默认带 */
  text-decoration: none;
  cursor: pointer;
}
a.btn:hover { border-color: #3a4356; }
a.btn.primary { background: var(--acc); border-color: var(--acc); color: #fff; font-weight: 600; }
a.btn.primary:hover { filter: brightness(1.08); }
a.btn.ghost { background: transparent; }
a.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ----------------------------- 内容区 ----------------------------- */
main#view { padding: 20px 22px 60px; max-width: 1440px; width: 100%; }
h2 { font-size: 15px; margin: 22px 0 10px; }
h2:first-child { margin-top: 0; }
.dim { color: var(--dim); }
.tiny { font-size: 11.5px; }
.hidden { display: none !important; }
.empty { color: var(--dim); padding: 28px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
}
.card .k { font-size: 11.5px; color: var(--dim); }
.card .v { font-size: 21px; font-weight: 650; margin-top: 5px; font-variant-numeric: tabular-nums; }
.card .s { font-size: 11.5px; color: var(--dim); margin-top: 2px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1080px) { .grid2 { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 11px; text-align: left; vertical-align: top; }
th { color: var(--dim); font-weight: 600; background: var(--panel2); white-space: nowrap; }
tbody tr:hover { background: #1b1f28; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.mono { font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.sub-row td { background: #14171e; color: #cfd6e4; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11.5px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.pill.ok { color: var(--ok); border-color: #1f4d3a; background: #12241d; }
.pill.warn { color: var(--warn); border-color: #4d4324; background: #241f12; }
.pill.err { color: var(--err); border-color: #4d2525; background: #241212; }
.pill.acc { color: var(--acc); border-color: #24374f; background: #121a24; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type="search"] { width: 240px; }
.right { margin-left: auto; }

/* ---------------------------- 配对全景（左流水 / 右附件） ----------------------------
 *
 * 两栏并排对照：左边银行流水、右边凭证附件。
 * 配色是这一页的核心功能，不是装饰：
 *   · `.is-paired`  **整行灰掉**（做完了，不用看）
 *   · `.is-open`    左侧加一条彩条，**没配对的跳出来**（用户的原话："一目了然"）
 * 灰掉的实现用 `opacity` + 去掉边框色，而不是 `color: gray` ——
 * 后者会把金额、状态 pill 一起变灰，连"这笔是多少钱"都看不清了。
 * -------------------------------------------------------------------------- */
.pair-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1180px) { .pair-grid { grid-template-columns: 1fr; } }
.pair-col { min-width: 0; }
/* --------------------------------------------------------------------------
 * `linklike`：**长得像链接的按钮**。
 *
 * 用在"次级入口"上（如「贵司软件没有引出模板？→ 用通用导入模板」）。
 * 为什么不做成普通按钮：它是一条**降级路径**（导入后要在软件里手工映射列名），
 * 摆成和主按钮一样的样式会诱导人选它 —— 而点它**不会报错**，
 * 代价要到软件里导入、发现列名对不上时才浮现。
 * 所以它在视觉上就该是"一行小字里可以点的那几个字"。
 * -------------------------------------------------------------------------- */
button.linklike {
  background: none; border: none; padding: 0; margin: 0 2px;
  color: var(--link, #2a6ebb); text-decoration: underline; cursor: pointer;
  font: inherit; font-size: inherit;
}
button.linklike:hover { opacity: 0.75; }
button.linklike:disabled { color: inherit; text-decoration: none; cursor: default; }
.pair-table { width: 100%; }
.pair-table th, .pair-table td { padding: 6px 8px; }
.pair-row.is-paired { opacity: 0.42; }
.pair-row.is-paired:hover { opacity: 0.75; }
.pair-row.is-open { border-left: 3px solid var(--warn); }
.pair-row[data-voucher]:not([data-voucher=""]) { cursor: pointer; }
.pair-row:hover { background: var(--panel2); }

.note { background: #14181f; border: 1px solid var(--line); border-left: 3px solid var(--acc); border-radius: 8px; padding: 10px 13px; margin: 12px 0; font-size: 13px; }
.note.warn { border-left-color: var(--warn); }
.note.err { border-left-color: var(--err); }
.note.ok { border-left-color: var(--ok); }

.aux { font-size: 11.5px; color: #9fb0cc; }
.bar { height: 7px; background: #20242e; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: var(--acc); }

/* ----------------------------- 模态与提示 ----------------------------- */
.modal { position: fixed; inset: 0; background: rgba(6, 8, 12, .68); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: min(880px, 100%); max-height: 86vh; display: flex; flex-direction: column; }
.modal-head { padding: 13px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.modal-body { padding: 16px; overflow: auto; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #1d2330;
  border: 1px solid var(--line);
  border-left: 3px solid var(--acc);
  border-radius: 8px;
  padding: 11px 15px;
  max-width: 460px;
  z-index: 60;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .45);
  font-size: 13px;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }

.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid #ffffff55; border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -1px; margin-right: 6px; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ----------------------------- 登录 ----------------------------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 28px;
  width: min(420px, 100%);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .5);
}
.field { margin-bottom: 13px; display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--dim); }
.field input, .field select { width: 100%; }
.lock { opacity: .45; cursor: not-allowed; }
.role-tag { font-size: 11.5px; }

/* ---- 票据收件 ---- */

.dropzone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 26px 20px;
  text-align: center;
  background: var(--panel);
  transition: border-color .15s, background .15s;
  margin: 14px 0;
}
.dropzone.over { border-color: var(--ok); background: var(--panel2); }
.drop-ico { font-size: 30px; line-height: 1.2; }
.drop-title { font-weight: 600; margin: 6px 0 4px; }
.drop-actions { display: flex; gap: 8px; justify-content: center; margin: 14px 0 6px; flex-wrap: wrap; }

.progress {
  height: 6px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin: 10px 0;
}
.progress-bar { height: 100%; width: 0; background: var(--ok); transition: width .15s; }

.cards { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.card {
  flex: 1 1 130px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.card-num { font-size: 22px; font-weight: 600; margin-top: 4px; }
.card-num.ok { color: var(--ok); }
.card-num.warn { color: var(--warn); }
.card-num.err { color: var(--err); }

/* ---- 复核（就地嵌在凭证清单里） ----
   复核不再是独立页面，而是凭证清单上的一层标注：
   需要复核的那一行下面直接跟一张判断卡片，判断完就在原地完成。 */

.review-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.review-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.review-body { display: flex; flex-direction: column; gap: 8px; }
.review-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.review-modify {
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.review-modify .field { width: 100%; margin-bottom: 0; }

/* 嵌在表格里的复核行：不要 hover 高亮（它不是一条数据），
   也不要在卡片内再套一层边框（视觉上会变成"卡片里的卡片"）。 */
.review-row td {
  padding: 0 0 10px 0;
  background: transparent;
  border: none;
}
.review-row .review-card {
  margin-bottom: 0;
  border-left: 3px solid var(--warn, #d99);
}
.review-row:hover { background: transparent; cursor: default; }
