/* ============ 金蝶风格界面样式 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px; color: #333; background: #eef1f5;
  overflow: hidden;               /* 页面整体不滚动, 由内容区滚动 */
}
a { text-decoration: none; color: #1a5cad; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #b8c4d4; border-radius: 4px; }

/* ---------- 顶部 ---------- */
.topbar {
  background: linear-gradient(180deg, #1c5aa8 0%, #154a8c 100%);
  color: #fff; height: 58px; display: flex; align-items: center;
  padding: 0 18px; box-shadow: 0 2px 6px rgba(0,0,0,.2);
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
}
.topbar .logo { display: flex; align-items: center; gap: 10px; }
.topbar .logo .mark {
  width: 36px; height: 36px; border-radius: 6px; background: #ffd34d;
  color: #154a8c; font-weight: 900; font-size: 20px; text-align: center; line-height: 36px;
}
.topbar .logo .t1 { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.topbar .logo .t2 { font-size: 11px; opacity: .85; margin-top: 1px; }
.topbar .spacer { flex: 1; }
.topbar .user { font-size: 13px; display: flex; align-items: center; gap: 12px; }
.topbar .user a { color: #fff; opacity: .9; }
.topbar .user a:hover { opacity: 1; text-decoration: underline; }

/* ---------- 左侧导航 ---------- */
.layout {
  display: flex;
  height: calc(100vh - 58px);
  margin-top: 58px;               /* 让开固定顶栏 */
  overflow: hidden;
}
.nav {
  width: 196px; background: #2b5797; color: #fff; padding: 10px 0; flex: none;
  height: 100%; overflow-y: auto;   /* 导航独立滚动, 始终可见 */
}
.nav .grp { font-size: 12px; color: #a9c4e8; padding: 10px 16px 4px; }
.nav a.it {
  display: flex; align-items: center; gap: 10px; padding: 11px 18px;
  color: #dbe8f7; font-size: 14px; border-left: 3px solid transparent;
}
.nav a.it .ico { width: 20px; text-align: center; }
.nav a.it:hover { background: #3a6aae; color: #fff; }
.nav a.it.on { background: #1d4a85; color: #fff; border-left-color: #ffd34d; font-weight: 700; }

.main { flex: 1; padding: 16px 18px; min-width: 0; height: 100%; overflow-y: auto; }
.page-title { font-size: 18px; font-weight: 700; color: #1d4a85; margin-bottom: 2px; }
.page-sub { color: #7a8699; font-size: 12px; margin-bottom: 14px; }

/* ---------- 面板 / 工具栏 ---------- */
.panel { background: #fff; border: 1px solid #d5dce6; border-radius: 6px; overflow: hidden; margin-bottom: 14px; }
.panel .ph {
  background: #f4f7fb; border-bottom: 1px solid #d5dce6; padding: 9px 14px;
  font-weight: 700; color: #1d4a85; display: flex; align-items: center; gap: 10px;
}
.panel .ph .r { flex: 1; text-align: right; font-weight: 400; color: #666; }
.panel .pb { padding: 12px 14px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px;
  background: #f8fafd; border-bottom: 1px solid #e2e8f0; }
.toolbar label { font-size: 13px; color: #445; }
.toolbar .grow { flex: 1; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid #b6c2d2;
  background: linear-gradient(180deg, #fff, #edf2f8); color: #333; font-size: 13px;
  padding: 6px 14px; border-radius: 4px; cursor: pointer; font-family: inherit;
}
.btn:hover { background: linear-gradient(180deg, #fff, #e0e9f3); border-color: #7ea2cc; }
.btn.primary { background: linear-gradient(180deg, #2e78cf, #1c5aa8); border-color: #154a8c; color: #fff; }
.btn.primary:hover { background: linear-gradient(180deg, #3888e2, #2168bb); }
.btn.danger { color: #c0392b; border-color: #e3b7b2; }
.btn.danger:hover { background: #fdf0ef; border-color: #d98880; }
.btn.green { color: #fff; background: linear-gradient(180deg, #3ba53b, #2c8a2c); border-color: #237023; }
.btn.green:hover { background: linear-gradient(180deg, #43b843, #339933); }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 表单 ---------- */
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  border: 1px solid #b8c4d4; border-radius: 4px; padding: 6px 8px; font-size: 13px;
  font-family: inherit; background: #fff; color: #333; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #2e78cf; box-shadow: 0 0 0 2px rgba(46,120,207,.15); }
input[readonly] { background: #f3f5f8; color: #555; }
label.f { display: inline-flex; align-items: center; gap: 6px; }
label.f b { font-weight: 400; color: #555; white-space: nowrap; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 16px; }
.fgrid .row { display: flex; align-items: center; gap: 8px; }
.fgrid .row label { width: 92px; text-align: right; color: #444; flex: none; }
.fgrid .row input, .fgrid .row select { flex: 1; min-width: 0; }

/* ---------- 表格 ---------- */
.g-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
.g-table th {
  background: #eef3fa; border: 1px solid #cfd9e6; padding: 7px 8px; text-align: left;
  color: #1d4a85; font-weight: 700; white-space: nowrap;
}
.g-table td { border: 1px solid #e3e9f1; padding: 6px 8px; vertical-align: middle; }
.g-table tr:nth-child(even) td { background: #fafcfe; }
.g-table tr:hover td { background: #eef6ff; }
.g-table .num, .g-table .r { text-align: right; font-variant-numeric: tabular-nums; }
.g-table .c { text-align: center; }
.g-table tfoot td { background: #f2f6fb; font-weight: 700; border-top: 2px solid #b9c9dd; }
.g-table .sub td { background: #fdfcf7; color: #8a7a3c; }
.g-table tr.tree-lv1 td { background: #eef2f8 !important; font-weight: 700; }
a.op { color: #1a5cad; margin-right: 8px; cursor: pointer; white-space: nowrap; }
a.op.red { color: #c0392b; }
a.op:hover { text-decoration: underline; }
.empty-tip { text-align: center; color: #999; padding: 30px 0; }

/* 凭证编辑表格 */
.v-grid input, .v-grid select { border-radius: 0; border-width: 0 0 1px; box-shadow: none; width: 100%; }
.v-grid td { padding: 2px; }
.v-grid td.sel { padding: 2px 8px; }

/* ---------- 状态徽章 ---------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.badge.blue { background: #e3f0ff; color: #1a5cad; }
.badge.green { background: #e5f7e5; color: #2c8a2c; }
.badge.gray { background: #eef0f3; color: #777; }
.badge.red { background: #fdecec; color: #c0392b; }

/* ---------- 统计卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: #fff; border: 1px solid #d5dce6; border-radius: 8px; padding: 14px 16px;
  border-top: 3px solid #2e78cf; }
.card.green { border-top-color: #2c8a2c; }
.card.orange { border-top-color: #e0962e; }
.card.purple { border-top-color: #7a5bb8; }
.card .k { font-size: 12px; color: #7a8699; }
.card .v { font-size: 21px; font-weight: 700; color: #1d4a85; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card .v.sm { font-size: 17px; }

/* ---------- 弹窗 ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20,30,50,.45); z-index: 90; display: none;
  align-items: flex-start; justify-content: center; padding: 40px 12px; }
.overlay.show { display: flex; }
.modal { background: #fff; border-radius: 8px; width: 620px; max-width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,.25); overflow: hidden; max-height: 92vh; display: flex; flex-direction: column; }
.modal.lg { width: 880px; }
.modal.sm { width: 420px; }
.modal .mh { background: #1c5aa8; color: #fff; padding: 11px 16px; font-weight: 700; display: flex; }
.modal .mh .x { margin-left: auto; cursor: pointer; opacity: .8; }
.modal .mb { padding: 16px; overflow: auto; }
.modal .mf { padding: 12px 16px; background: #f4f7fb; text-align: right; border-top: 1px solid #d5dce6; }

/* ---------- 树(科目) ---------- */
.tree { font-size: 13px; }
.tree ul { list-style: none; }
.tree li { padding: 0; }
.tree .node {
  display: flex; align-items: center; padding: 5px 10px; cursor: pointer; border-radius: 4px; gap: 6px;
}
.tree .node:hover { background: #e9f1fb; }
.tree .node.sel { background: #2e78cf; color: #fff; }
.tree .caret { width: 14px; color: #98a6b8; display: inline-block; }
.tree .nm { font-weight: 600; }
.tree .cd { color: #7a8699; margin-left: 4px; font-size: 12px; }
.tree .leaf { color: #999; font-size: 12px; margin-left: auto; }

/* 凭证字样式 */
.voucher-paper { padding: 18px; }
.voucher-paper h2 { text-align: center; font-size: 17px; letter-spacing: 6px; color: #1d4a85; margin-bottom: 6px; }
.voucher-head { display: flex; justify-content: space-between; margin: 8px 0 4px; font-size: 13px; }
.voucher-head div b { font-weight: 600; }
.v-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.v-table th, .v-table td { border: 1px solid #111; padding: 5px 8px; }
.v-table th { background: #fff; color: #000; }

/* toast */
#toast { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: #333; color: #fff; padding: 9px 22px; border-radius: 6px; font-size: 14px;
  display: none; box-shadow: 0 4px 16px rgba(0,0,0,.3); max-width: 80vw; }
#toast.err { background: #c0392b; }
#toast.ok { background: #2c8a2c; }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #164a86, #2e78cf 60%, #5a9bd8); }
.login-box { background: #fff; border-radius: 10px; width: 380px; padding: 30px 34px;
  box-shadow: 0 16px 50px rgba(0,0,0,.3); }
/* 登录页头部：图标在上、标题在下，整体居中 */
.login-box .logo { display: flex; flex-direction: column; align-items: center;
  gap: 10px; margin-bottom: 22px; text-align: center; }
.login-box .logo .mark { width: 46px; height: 46px; border-radius: 8px; background: #ffd34d;
  color: #154a8c; font-weight: 900; font-size: 26px; text-align: center; line-height: 46px; }
.login-box h1 { font-size: 20px; color: #154a8c; }
.login-box .tip { color: #999; font-size: 12px; margin-top: 2px; }
.login-box .f { margin-bottom: 16px; }
.login-box .f input { width: 100%; padding: 10px 12px; font-size: 14px; }

/* ---------- 打印 ---------- */
@media print {
  body { background: #fff; overflow: visible; }
  .layout { display: block; height: auto; margin-top: 0; overflow: visible; }
  .main { height: auto; overflow: visible; }
  .no-print, .nav, .topbar, .toolbar, .page-sub { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; }
  .panel { border: none; }
  .g-table th { background: #fff; }
  .print-title { text-align: center; font-size: 16px; font-weight: 700; margin: 8px 0; }
  .report-info { text-align: center; color: #333; font-size: 12px; margin-bottom: 8px; }
}
.print-title { text-align: center; font-size: 16px; font-weight: 700; margin: 8px 0 4px; }
.report-info { text-align: center; color: #666; font-size: 12px; margin-bottom: 8px; }


/* ---------- 被弹窗内嵌(iframe)时: 隐藏顶栏与导航, 占满整屏 ---------- */
html.in-frame .topbar, html.in-frame .nav { display: none !important; }
html.in-frame .layout { margin-top: 0; height: 100vh; }
html.in-frame #btnBack { display: none !important; }

/* 平铺搜索结果行 */
#accTreeBox ul li > .node { border-bottom:1px dashed #eef1f5; }
#accTreeBox ul li > .node:hover { background:#e9f1fb; }

/* “关闭”按钮只在弹窗(iframe)内显示; 正常页面不显示 */
#btnClose { display: none !important; }
html.in-frame #btnClose { display: inline-flex !important; }

/* ---------- 合作记账平台补充样式 ---------- */
.badge.orange { background: #fff3e0; color: #b26a00; }
.nav-badge { background: #ffd34d; color: #154a8c; border-radius: 9px; padding: 0 7px;
  font-size: 11px; font-weight: 700; margin-left: 6px; }
input[readonly], input[disabled] { background: #f3f5f8; color: #555; }
