/* ===== 城丰财务系统 · 浅色主题（对齐物业系统配色） ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", sans-serif;
  background: #f1f5f9; color: #1e293b; font-size: 14px;
}
.layout { display: flex; min-height: 100vh; }

/* ===== 侧边栏 ===== */
.sidebar {
  width: 216px; background: #0f172a; color: #cbd5e1; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-ico { font-size: 22px; }
.brand-name { color: #fff; font-size: 15px; font-weight: 700; }
.brand-sub { color: #64748b; font-size: 11px; margin-top: 2px; }

.side-company { padding: 0 14px 14px; border-bottom: 1px solid #1e293b; }
.side-company select {
  width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 13px;
  background: #1e293b; color: #e2e8f0; border: 1px solid #334155; outline: none;
}
.co-meta { font-size: 11px; color: #64748b; margin-top: 6px; line-height: 1.5; }

/* ★ 分组标题必须比子项亮（≥#e2e8f0 + 13px + 加粗）—— 太灰=像没权限 */
.nav { padding: 8px 0; flex: 1; }
.nav-folder { }
.nav-group {
  font-size: 13px; color: #e2e8f0; padding: 12px 18px 8px;
  letter-spacing: .5px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.nav-group:hover { color: #fff; }
.fold-ico { font-size: 10px; color: #cbd5e1; }
.fold-badge {
  margin-left: auto; background: #dc2626; color: #fff; font-size: 10px;
  border-radius: 9px; padding: 1px 6px; font-weight: 600; display: none;
}
.fold-badge.on { display: inline-block; }

.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 30px;
  font-size: 14px; cursor: pointer; color: #cbd5e1;
  border-left: 3px solid transparent;
}
.nav-item .ico { font-size: 15px; width: 18px; text-align: center; }
.nav-item:hover { background: #1e293b; color: #fff; }
.nav-item.on { background: #1e3a8a; color: #fff; border-left-color: #3b82f6; font-weight: 600; }
.nav-item.disabled { color: #475569; cursor: not-allowed; }
.nav-flag { margin-left: auto; font-size: 10px; color: #f59e0b; }

.side-foot { padding: 14px 18px; border-top: 1px solid #1e293b; }
.side-user { color: #e2e8f0; font-size: 13px; font-weight: 600; }
.side-note { color: #64748b; font-size: 11px; margin-top: 4px; }

/* ===== 主区 ===== */
.main { flex: 1; padding: 22px 26px; min-width: 0; }
.page-title {
  font-size: 19px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.page-title .sub { font-size: 12px; color: #94a3b8; font-weight: 400; }

/* ===== 卡片 ===== */
.card {
  background: #fff; border-radius: 14px; padding: 18px 20px;
  box-shadow: 0 2px 10px rgba(15,23,42,.05); margin-bottom: 16px;
}
.card-title {
  font-size: 15px; font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.card-title .tip { font-size: 12px; color: #94a3b8; font-weight: 400; margin-left: auto; }

/* ===== 统计条（紧凑高密度） ===== */
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat {
  flex: 1; min-width: 150px; background: #fff; border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 2px 10px rgba(15,23,42,.05); border-left: 4px solid #3b82f6;
}
.stat.g { border-left-color: #10b981; }
.stat.r { border-left-color: #ef4444; }
.stat.o { border-left-color: #f59e0b; }
.stat-label { font-size: 12px; color: #64748b; margin-bottom: 6px; }
.stat-val { font-size: 20px; font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; }
.stat-val.g { color: #059669; }
.stat-val.r { color: #dc2626; }

/* ===== 工具条（一排能放几项放几项） ===== */
.toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 12px; background: #fff; border-radius: 12px; padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(15,23,42,.05);
}
.toolbar .sp { margin-left: auto; }

/* ===== 表单元素 ===== */
input, select, textarea {
  font-family: inherit; font-size: 13px; color: #1e293b;
  background: #fff; border: 1px solid #cbd5e1; border-radius: 8px;
  padding: 7px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #3b82f6; }
input[readonly] { background: #f1f5f9; color: #64748b; }
input[type=date] { cursor: pointer; }
.tb-inp { width: 130px; }
.tb-inp.wide { width: 190px; }

/* ===== 按钮 ===== */
.btn {
  font-family: inherit; font-size: 13px; cursor: pointer;
  padding: 7px 14px; border-radius: 8px; border: 1px solid #cbd5e1;
  background: #fff; color: #334155; white-space: nowrap;
}
.btn:hover { background: #f8fafc; border-color: #94a3b8; }
.btn.pri { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 600; }
.btn.pri:hover { background: #1d4ed8; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.danger { color: #dc2626; border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-link { color: #2563eb; cursor: pointer; font-size: 12px; background: none; border: none; padding: 2px 4px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: #dc2626; }

/* ===== 表格 ===== */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; color: #64748b; font-weight: 500;
  padding: 10px 8px; border-bottom: 1px solid #e2e8f0; white-space: nowrap;
}
th.r, td.r { text-align: right; }
th.c, td.c { text-align: center; }
td { padding: 10px 8px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
tr:hover td { background: #f8fafc; }
/* ★ 表格单元格不换行（否则「银行转账」「苏经芬」被切成两行） */
#jTbl td, #jTbl th { white-space: nowrap; }
#jTbl td:nth-child(6) { white-space: normal; min-width: 160px; }   /* 摘要列可换行 */
.tbl-wrap { overflow-x: auto; }
.num { font-variant-numeric: tabular-nums; }
.amt-in { color: #059669; font-weight: 600; font-variant-numeric: tabular-nums; }
.amt-out { color: #dc2626; font-weight: 600; font-variant-numeric: tabular-nums; }
.bal { color: #0f172a; font-weight: 600; font-variant-numeric: tabular-nums; }
.bal.neg, span.bal.neg { color: #dc2626 !important; }   /* ★ 负数余额标红 */
.empty { text-align: center; color: #94a3b8; padding: 40px 0; font-size: 14px; }

/* ===== 标签 ===== */
.tag {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 6px;
  background: #f1f5f9; color: #475569; white-space: nowrap;
}
.tag.in { background: #dcfce7; color: #166534; }
.tag.out { background: #fee2e2; color: #991b1b; }
.tag.src-api { background: #dbeafe; color: #1e40af; }
.tag.src-manual { background: #f1f5f9; color: #475569; }
.tag.src-imp { background: #fef3c7; color: #92400e; }
.tag.mod { background: #fef3c7; color: #92400e; }
.tag.cash { background: #e0e7ff; color: #3730a3; }

/* ===== 弹窗（表单类默认点遮罩不关） ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center; z-index: 999;
  padding: 20px;
}
.modal {
  background: #fff; border-radius: 16px; width: 860px; max-width: 94vw;
  max-height: 88vh; overflow-y: auto; padding: 24px 28px;
  box-shadow: 0 20px 50px rgba(15,23,42,.3);
}
.modal.wide { width: 1100px; }
.modal.narrow { width: 520px; }
.sh-t {
  display: flex; align-items: center; font-size: 16px; font-weight: 700;
  margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid #f1f5f9;
}
.sh-x { margin-left: auto; cursor: pointer; color: #94a3b8; font-size: 20px; line-height: 1; }
.sh-x:hover { color: #475569; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 18px; }
.form-full { grid-column: 1 / -1; }
.frow { margin-bottom: 14px; }
.frow label { display: block; font-size: 12px; color: #64748b; margin-bottom: 6px; }
.frow label .req { color: #dc2626; }
.frow input, .frow select, .frow textarea { width: 100%; }
.frow textarea { resize: vertical; min-height: 60px; }
.fhint { font-size: 11px; color: #94a3b8; margin-top: 4px; }
.fhint.warn { color: #d97706; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid #f1f5f9;
}

/* ===== 提示条 ===== */
.notice {
  border-radius: 10px; padding: 10px 14px; font-size: 13px;
  margin-bottom: 12px; display: flex; gap: 8px; align-items: flex-start;
}
.notice.info { background: #eff6ff; color: #1e40af; border-left: 3px solid #3b82f6; }
.notice.warn { background: #fffbeb; color: #92400e; border-left: 3px solid #f59e0b; }
.notice.ok   { background: #f0fdf4; color: #166534; border-left: 3px solid #10b981; }

/* ===== 批量导入预览表 ===== */
.chk-all { cursor: pointer; }
tr.row-err td { background: #fef2f2 !important; }
tr.row-dup td { background: #fffbeb !important; }
.st-ok { color: #059669; font-weight: 600; }
.st-err { color: #dc2626; font-weight: 600; }
.st-dup { color: #d97706; font-weight: 600; }

/* ===== 待开发占位 ===== */
.todo {
  background: #fff; border-radius: 14px; padding: 48px 24px; text-align: center;
  box-shadow: 0 2px 10px rgba(15,23,42,.05);
}
.todo .t-ico { font-size: 40px; margin-bottom: 12px; }
.todo .t-name { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.todo .t-desc { color: #64748b; font-size: 13px; line-height: 1.8; max-width: 560px; margin: 0 auto; }
.todo .t-stage {
  display: inline-block; margin-top: 16px; font-size: 12px; padding: 4px 12px;
  border-radius: 20px; background: #f1f5f9; color: #475569;
}
.todo .t-stage.v1 { background: #dbeafe; color: #1e40af; }

/* ===== 登录页 ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%); padding: 20px;
}
.login-card {
  background: #fff; border-radius: 18px; padding: 36px 40px; width: 400px;
  max-width: 94vw; box-shadow: 0 24px 60px rgba(2,6,23,.45);
}
.login-brand { text-align: center; margin-bottom: 26px; }
.lb-ico { font-size: 40px; margin-bottom: 8px; }
.lb-name { font-size: 19px; font-weight: 700; color: #0f172a; }
.lb-sub { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.login-btn { width: 100%; padding: 11px; font-size: 15px; margin-top: 6px; }
.login-err { color: #dc2626; font-size: 13px; min-height: 18px; margin-bottom: 4px; }
.login-hint {
  margin-top: 22px; padding-top: 16px; border-top: 1px solid #f1f5f9;
  font-size: 12px; color: #64748b; line-height: 1.9;
}
.login-hint b { color: #334155; }
.login-foot { margin-top: 14px; font-size: 11px; color: #cbd5e1; text-align: center; }

/* ===== 侧边栏：公司管理按钮 / 用户信息 ===== */
.co-manage { width: 100%; margin-top: 8px; font-size: 12px; padding: 5px 8px; }
.side-role {
  font-size: 11px; color: #94a3b8; margin-top: 2px;
}
.side-role .rtag {
  display: inline-block; background: #1e3a8a; color: #93c5fd;
  padding: 1px 7px; border-radius: 5px; font-weight: 600;
}
.side-out { width: 100%; margin-top: 10px; font-size: 12px; padding: 5px; }

/* ===== 权限勾选表 ===== */
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.perm-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-radius: 8px; font-size: 13px; cursor: pointer;
}
.perm-item:hover { background: #f8fafc; }
.perm-item input { width: 15px; height: 15px; cursor: pointer; }
.perm-group-title {
  font-size: 12px; color: #64748b; font-weight: 600;
  margin: 12px 0 4px; padding-left: 2px; grid-column: 1 / -1;
}

/* ===== 公司卡片列表 ===== */
.co-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.co-item {
  border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px;
}
.co-item.cur { border-color: #3b82f6; background: #eff6ff; }
.co-item .ci-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.co-item .ci-meta { font-size: 11px; color: #64748b; line-height: 1.6; }
.co-item .ci-act { margin-top: 8px; display: flex; gap: 6px; }
