* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-size: 13px;
  color: #2b3440;
  background: #f4f5f7;
}
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* 登录页 */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: #1f2733; padding: 16px;
}
.login-card {
  width: 390px; max-width: 95vw; background: #fff;
  border-radius: 8px; padding: 32px; box-shadow: 0 12px 40px rgba(0,0,0,.28);
}
.login-logo { text-align: center; margin-bottom: 22px; }
.login-logo .mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; background: #2d7ff9; color: #fff;
  border-radius: 10px; font-weight: 700; font-size: 18px;
}
.login-logo h1 { font-size: 18px; margin-top: 12px; color: #1f2733; }
.login-logo p { font-size: 12px; color: #8c95a2; margin-top: 4px; }
.login-tabs { display: flex; border-bottom: 1px solid #e8eaed; margin-bottom: 18px; }
.login-tabs button {
  flex: 1; background: none; border: none; padding: 9px 0; font-size: 13px;
  color: #7c8594; border-bottom: 2px solid transparent;
}
.login-tabs button.active { color: #2d7ff9; font-weight: 600; border-bottom-color: #2d7ff9; }
.login-field { margin-bottom: 14px; }
.login-field label { display: block; font-size: 12px; color: #666; margin-bottom: 6px; }
.login-field input {
  width: 100%; height: 38px; border: 1px solid #dcdfe4; border-radius: 4px;
  padding: 0 12px; font-size: 13px; outline: none;
}
.login-field input:focus { border-color: #2d7ff9; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.code-btn {
  width: 112px; height: 38px; border: 1px solid #2d7ff9; color: #2d7ff9;
  background: #fff; border-radius: 4px; font-size: 12px;
}
.code-btn:hover { background: #eef5ff; }
.sms-dev-hint {
  margin-top: 6px; padding: 6px 10px; background: #edf6ff;
  border: 1px solid #bfdcfb; border-radius: 4px; color: #1d5fb8; font-size: 12px;
}
.login-submit {
  width: 100%; height: 40px; border: none; border-radius: 4px;
  background: #2d7ff9; color: #fff; font-size: 14px; font-weight: 600; margin-top: 6px;
}
.login-submit:hover { background: #1f6fe5; }
.login-hint { font-size: 11px; color: #8c95a2; text-align: center; margin-top: 16px; line-height: 1.6; }

/* 主布局 */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: 54px; background: #1f2733; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; border-bottom: 1px solid #2b3545; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px; background: #2d7ff9;
  color: #fff; font-size: 12px; font-weight: 700;
}
.brand-name { font-size: 15px; font-weight: 600; }
.brand-sub { font-size: 11px; color: #8b95a5; }
.top-right { display: flex; align-items: center; gap: 14px; font-size: 12px; color: #c9d0da; }
.user-chip { display: flex; align-items: center; gap: 7px; cursor: pointer; padding: 4px 8px; border-radius: 4px; }
.user-chip:hover { background: #2b3441; }
.role-tag { background: #2d7ff9; color: #fff; border-radius: 3px; padding: 1px 6px; font-size: 11px; }
.link-btn { background: none; border: none; color: #c9d0da; font-size: 12px; }
.link-btn:hover { color: #fff; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; background: #3f4a5a; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.layout { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: 172px; background: #1f2733; color: #aab3c0;
  flex-shrink: 0; display: flex; flex-direction: column; justify-content: space-between;
}
.sidebar-nav { padding: 8px 0; overflow-y: auto; flex: 1; }
.nav-group { margin-bottom: 4px; }
.nav-group-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; font-size: 12px; font-weight: 600; color: #dce2ec; cursor: pointer;
}
.nav-group-title:hover { background: #28313e; }
.nav-sub-list { background: #1a212b; }
.nav-sub {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 8px 14px 8px 26px; font-size: 12px; color: #9ea8b6;
}
.nav-sub:hover { color: #fff; background: #252e3a; }
.nav-sub.active { background: #2d7ff9; color: #fff; font-weight: 500; }

.sidebar-foot {
  border-top: 1px solid #2b3545; padding: 10px 12px; background: #1a212b;
}
.sf-user { display: flex; align-items: center; gap: 8px; }
.sf-meta { min-width: 0; }
.sf-name { font-size: 12px; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-sub { font-size: 11px; color: #8b95a5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-actions { display: flex; gap: 8px; margin-top: 8px; }
.sf-actions button {
  flex: 1; background: #273140; border: none; border-radius: 3px;
  color: #c9d0da; padding: 4px 0; font-size: 11px;
}
.sf-actions button:hover { background: #334054; color: #fff; }

/* 主内容区：min-width: 0 防止表格撑宽页面 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-x: hidden; }
.crumb {
  height: 40px; background: #fff; border-bottom: 1px solid #e8eaed;
  display: flex; align-items: center; padding: 0 20px; font-size: 12px; color: #8a929e;
}
.page-body { padding: 18px 20px; flex: 1; min-width: 0; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.page-head-left h2 { font-size: 17px; color: #1f2733; font-weight: 600; }
.page-head-left p { font-size: 12px; color: #8c95a2; margin-top: 3px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  height: 32px; padding: 0 13px; border-radius: 4px; font-size: 12px;
  border: 1px solid #dcdfe4; background: #fff; color: #333;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn:hover { border-color: #2d7ff9; color: #2d7ff9; }
.btn-primary { background: #2d7ff9; border-color: #2d7ff9; color: #fff; }
.btn-primary:hover { background: #1f6fe5; color: #fff; }
.btn-danger { background: #fff; border-color: #f3b5b5; color: #d93f3f; }
.btn-danger:hover { background: #fff5f5; border-color: #d93f3f; color: #d93f3f; }
.btn-sm { height: 26px; padding: 0 9px; font-size: 11px; }

.card {
  background: #fff; border: 1px solid #e8eaed; border-radius: 4px;
  padding: 16px; margin-bottom: 14px; min-width: 0;
}
.card-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 600; color: #1f2733; margin-bottom: 12px; gap: 8px;
}
.card-sub { font-size: 12px; color: #8c95a2; font-weight: 400; }

/* 统计卡片：自适应网格 */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 12px; margin-bottom: 14px;
}
.stat { background: #fff; border: 1px solid #e8eaed; border-radius: 4px; padding: 14px 16px; }
.stat .label { font-size: 12px; color: #8c95a2; }
.stat .num { font-size: 22px; font-weight: 600; color: #2d7ff9; margin-top: 6px; }
.stat .num.warn { color: #e08b1e; }
.stat .num.ok { color: #2e9e5b; }
.stat .sub { font-size: 11px; color: #9ea8b6; margin-top: 4px; }

/* 紧凑主体筛选条（替代原超长纵向列表） */
.entity-bar {
  background: #fff; border: 1px solid #e8eaed; border-radius: 4px;
  padding: 12px 14px; margin-bottom: 14px;
}
.entity-bar-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.entity-bar-top label { font-size: 12px; color: #5c636e; font-weight: 600; }
.entity-bar-top select {
  height: 30px; border: 1px solid #dcdfe4; border-radius: 4px;
  padding: 0 10px; font-size: 12px; min-width: 240px; max-width: 100%;
}
.entity-pills {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.entity-pill {
  border: 1px solid #e1e5eb; background: #fafbfc; color: #4a5360;
  border-radius: 3px; padding: 4px 10px; font-size: 11.5px;
}
.entity-pill:hover { border-color: #2d7ff9; color: #2d7ff9; }
.entity-pill.active { background: #e8f1ff; border-color: #2d7ff9; color: #1b65d8; font-weight: 600; }

/* 工具栏与表格横向滚动容器 */
.toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.search-box {
  height: 32px; border: 1px solid #dcdfe4; border-radius: 4px;
  display: flex; align-items: center; padding: 0 10px; background: #fff; width: 250px;
}
.search-box input { border: none; outline: none; font-size: 12px; width: 100%; }
.filter-select {
  height: 32px; border: 1px solid #dcdfe4; border-radius: 4px; padding: 0 10px; font-size: 12px; background: #fff;
}
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead th {
  background: #fafbfc; color: #5c636e; font-weight: 600; text-align: left;
  padding: 10px 10px; border-bottom: 1px solid #e8eaed; white-space: nowrap;
}
tbody td {
  padding: 10px 10px; border-bottom: 1px solid #f0f1f3; color: #3d4550; white-space: nowrap;
}
tbody tr:hover { background: #fafbfd; }
.op-links a, .op-links button {
  color: #2d7ff9; background: none; border: none; padding: 0; margin-right: 10px; font-size: 12px; cursor: pointer;
}
.op-links a.del, .op-links button.del { color: #e24c4c; }

.badge {
  display: inline-block; font-size: 11px; border-radius: 3px; padding: 2px 7px; font-weight: 500;
}
.badge-pending { background: #fff3e6; color: #d47b14; }
.badge-doing { background: #e8f1ff; color: #2d7ff9; }
.badge-done { background: #e8f7ee; color: #268f4f; }
.badge-danger { background: #fdecec; color: #d93f3f; }
.badge-gray { background: #f1f3f5; color: #6c7582; }

.pager {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; margin-top: 14px; font-size: 12px; color: #666;
}
.pager button {
  background: #fff; border: 1px solid #dcdfe4; border-radius: 3px;
  height: 28px; padding: 0 10px; font-size: 12px;
}
.pager button:disabled { color: #c0c6cf; cursor: not-allowed; background: #fafbfc; }

/* 工作台双栏 & 计算器 */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }
.todo-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 2px; border-bottom: 1px solid #f2f3f5; font-size: 12px;
}
.todo-row:last-child { border-bottom: none; }
.todo-row .tt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-row .tt.done { text-decoration: line-through; color: #9ea8b6; }
.calc-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.calc-tabs button {
  padding: 6px 14px; border: 1px solid #dcdfe4; background: #fafbfc;
  border-radius: 4px; font-size: 12px; color: #5c636e;
}
.calc-tabs button.active { background: #2d7ff9; border-color: #2d7ff9; color: #fff; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.calc-field { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.calc-field label { width: 100px; flex-shrink: 0; font-size: 12px; color: #666; }
.calc-field input, .calc-field select {
  flex: 1; height: 32px; border: 1px solid #dcdfe4; border-radius: 4px; padding: 0 8px; font-size: 12px;
}
.calc-quick { display: flex; gap: 6px; margin: -4px 0 10px 108px; flex-wrap: wrap; }
.calc-quick button {
  padding: 2px 8px; border: 1px solid #dcdfe4; background: #fff; border-radius: 3px; font-size: 11px; color: #666;
}
.calc-quick button:hover { border-color: #2d7ff9; color: #2d7ff9; }
.calc-out { background: #f7f9fc; border-radius: 5px; padding: 8px 14px; }
.calc-out-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px dashed #e8eaed; font-size: 12px; color: #666;
}
.calc-out-row:last-child { border-bottom: none; }
.calc-out-row b { font-size: 15px; color: #1f2733; }
.calc-out-row b.hl { color: #e24c4c; }
.calc-out-row b.ok { color: #268f4f; }
.calc-note { font-size: 11px; color: #8c95a2; line-height: 1.6; margin-top: 10px; }

/* 发票上下游图谱 */
.graph-box {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center;
  background: #f8fafc; border: 1px solid #e6ebf2; border-radius: 6px; padding: 14px; margin-bottom: 14px;
}
.graph-col h4 { font-size: 12px; color: #5c636e; margin-bottom: 8px; }
.graph-node {
  background: #fff; border: 1px solid #e2e6ed; border-radius: 4px; padding: 7px 10px;
  font-size: 12px; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px;
}
.graph-center {
  background: #2d7ff9; color: #fff; border-radius: 6px; padding: 12px 16px;
  text-align: center; font-weight: 600; min-width: 150px;
}

/* 银行名录网格 */
.bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.bank-card {
  border: 1px solid #e8eaed; border-radius: 4px; padding: 11px 12px; background: #fafbfc;
}
.bank-card-top { display: flex; align-items: center; gap: 8px; }
.bank-badge {
  width: 28px; height: 28px; border-radius: 4px; background: #e8f1ff; color: #2d7ff9;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}
.bank-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.bank-tag { font-size: 10.5px; background: #fff; border: 1px solid #dce2ea; border-radius: 3px; padding: 1px 6px; color: #4b5563; }

/* 弹窗 */
.mask {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
  align-items: center; justify-content: center; z-index: 60; padding: 16px;
}
.mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 6px; width: 620px; max-width: 96vw; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: 0 12px 36px rgba(0,0,0,.22);
}
.modal.modal-lg { width: 820px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #e8eaed;
}
.modal-head h3 { font-size: 15px; color: #1f2733; }
.modal-close { background: none; border: none; font-size: 20px; color: #8c95a2; line-height: 1; }
.modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid #e8eaed; background: #fafbfc;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-row.full { grid-column: 1 / -1; }
.form-row label { font-size: 12px; color: #5c636e; }
.form-row input, .form-row select, .form-row textarea {
  border: 1px solid #dcdfe4; border-radius: 4px; padding: 7px 10px; font-size: 12.5px; outline: none;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: #2d7ff9; }
.section-title {
  font-size: 12.5px; font-weight: 600; color: #2d7ff9; margin: 14px 0 8px;
  padding-bottom: 4px; border-bottom: 1px solid #eef1f5;
}
.perm-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid #f2f3f5; font-size: 12px;
}

.toast-box {
  position: fixed; top: 18px; right: 18px; z-index: 99; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: #1f2733; color: #fff; padding: 9px 14px; border-radius: 4px;
  font-size: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.toast.ok { background: #268f4f; }
.toast.err { background: #d93f3f; }
.empty { text-align: center; color: #9ea8b6; padding: 28px 12px; font-size: 12px; }
