/* 任我行协同CRM 复刻原型 · Web端全局样式 */
:root {
  --navy-900: #17365d; --navy-700: #1e3f61; --navy-500: #2b5c8f; --navy-300: #4a7fb5;
  --page-bg: #e9eef5; --surface: #fff; --border: #c9d6e4; --border-light: #e3ecf4;
  --link: #1a5a9e; --text: #333c45; --text-sub: #6b7a8c; --head-text: #164a7c;
  --thead: #d8e8f7; --row-alt: #f4faff; --row-hover: #e8f3fc; --row-sel: #ffefb0;
  --label-bg: #d8e8f7; --value-bg: #fffde9; --total-bg: #fdf3cf;
  --apv-bg: #fff9c8; --apv-border: #e8d98f;
  --btn-border: #a5b6c8; --btn-blue: #3c78c3;
  --req-red: #cc0000; --danger: #c9302c; --warn: #d98e04; --ok: #3d8f43;
  --shadow: 0 2px 8px rgba(23, 54, 93, .18);
  font-size: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", sans-serif; background: var(--page-bg); color: var(--text); font-size: 12px; overflow-x: hidden; }
a { color: var(--link); text-decoration: none; }
a:hover { color: #d97a00; text-decoration: underline; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 12px; color: var(--text); outline: none; }
.ic { vertical-align: -3px; }

/* ---------- 顶栏 ---------- */
.tb { position: fixed; top: 0; left: 0; right: 0; height: 44px; z-index: 60; background: linear-gradient(180deg, #2f5f8f, #1d3d5f 88%); border-bottom: 1px solid #142c47; }
.tb-in { display: flex; align-items: center; height: 100%; padding: 0 12px 0 10px; }
.tb-logo .lg-b { color: #fff; font-size: 17px; font-weight: 700; letter-spacing: 1px; font-style: italic; }
.tb-logo .lg-s { color: #cfe2f5; font-size: 12px; font-weight: 600; letter-spacing: 2px; }
.tb-logo { display: flex; align-items: flex-end; gap: 5px; margin-right: 22px; white-space: nowrap; }
.tb-logo .lg-img { height: 22px; max-width: 110px; margin-left: 4px; margin-right: 8px; object-fit: contain; }
.tb-acts { display: flex; align-items: center; margin-left: auto; }
.tb-it { color: #e8f1fa; padding: 0 13px; line-height: 44px; cursor: pointer; position: relative; white-space: nowrap; }
.tb-it:hover { color: #fff; text-decoration: none; background: rgba(255, 255, 255, .08); }
.tb-it .ic { vertical-align: -2px; }
.tb-dot { display: inline-block; min-width: 15px; height: 15px; line-height: 15px; text-align: center; background: #e64545; color: #fff; border-radius: 8px; font-size: 10px; margin-left: 3px; padding: 0 3px; }

/* ---------- 左侧图标栏 ---------- */
.rail { position: fixed; left: 0; top: 44px; bottom: 0; width: 72px; z-index: 55; background: var(--navy-700); overflow-y: auto; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail-it { position: relative; display: block; text-align: center; padding: 11px 0 9px; color: #b9cfe6; cursor: pointer; border-left: 3px solid transparent; }
.rail-it span { display: block; margin-top: 4px; font-size: 11px; }
.rail-it:hover { color: #fff; text-decoration: none; background: rgba(255, 255, 255, .06); }
.rail-it.on { background: var(--navy-500); color: #fff; border-left-color: #f0a63c; }
.rail-grp { position: relative; }
.rl-ct { position: absolute; right: 3px; top: 12px; opacity: .55; line-height: 1; transition: transform .2s; }
.rail-grp.open .rl-ct { transform: rotate(90deg); }
.rail-grp.open .rail-it { background: var(--navy-500); color: #fff; }
/* 子菜单：单击向下展开 / 再击收起（手风琴） */
.rail-menu { max-height: 0; overflow: hidden; transition: max-height .25s ease; background: rgba(0, 0, 0, .18); }
.rail-grp.open .rail-menu { max-height: 200px; }
.rail-mi { display: block; padding: 7px 2px; text-align: center; color: #b9cfe6; white-space: nowrap; font-size: 11px; border-left: 3px solid transparent; }
.rail-mi:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.rail-mi.on { background: var(--navy-500); color: #fff; border-left-color: #f0a63c; }
/* 版本号：菜单底部 */
.rail-ver { position: sticky; bottom: 0; margin-top: 16px; padding: 8px 0 10px; text-align: center; color: #7e97b3; font-size: 10px; letter-spacing: 1px; background: linear-gradient(180deg, rgba(30, 63, 97, 0), rgba(23, 54, 93, .9) 40%); user-select: none; }

/* ---------- 工作区 ---------- */
.ws { margin: 0 0 0 72px; padding-top: 44px; min-height: 100vh; box-sizing: border-box; }
.ptabs { display: flex; align-items: stretch; height: 30px; background: #f2f6fb; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.ptabs::-webkit-scrollbar { display: none; }
.pt-it { display: flex; align-items: center; padding: 0 10px 0 16px; color: #456; border-right: 1px solid var(--border-light); background: #eaf0f7; white-space: nowrap; cursor: pointer; user-select: none; }
.pt-it:hover { background: #f6f9fc; text-decoration: none; }
.pt-it.on { background: #fff; color: var(--head-text); font-weight: 700; box-shadow: inset 0 2px 0 var(--navy-500); }
.pt-x { margin-left: 8px; width: 15px; height: 15px; line-height: 13px; text-align: center; border-radius: 2px; color: #9ab; font-size: 14px; flex: none; }
.pt-it.on .pt-x { color: #789; }
.pt-x:hover { background: #dce6f2; color: #c9302c; }

/* ---------- 页面通用 ---------- */
#main { padding: 8px; animation: fadeup .18s ease; }
@keyframes fadeup { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.panel { background: var(--surface); border: 1px solid var(--border); }
.panel + .panel { margin-top: 8px; }
.panel-hd { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 6px 10px; background: linear-gradient(180deg, #fbfdff, #eef4fa); border-bottom: 1px solid var(--border-light); }
.panel-title { font-weight: 700; color: var(--head-text); margin-right: 8px; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 5px 8px; background: #f6f9fc; border-bottom: 1px solid var(--border-light); }
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 5px 8px; border-bottom: 1px solid var(--border-light); background: #fff; }
.filter-bar label { color: var(--text-sub); }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 11px; background: linear-gradient(180deg, #fdfdfd, #e3e8ee); border: 1px solid var(--btn-border); border-radius: 2px; color: #33475e; cursor: pointer; font-size: 12px; white-space: nowrap; }
.btn:hover { background: linear-gradient(180deg, #ffffff, #eef2f7); border-color: #7f97b1; }
.btn:active { background: #dde5ee; }
.btn-blue { background: linear-gradient(180deg, #4c85c8, #3468a8); border-color: #2c5c98; color: #fff; }
.btn-blue:hover { background: linear-gradient(180deg, #5b92d3, #3c78c3); color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: #fdf3f3; }
.btn-sm { height: 20px; padding: 0 8px; font-size: 12px; }
.btn-link { border: none; background: none; color: var(--link); cursor: pointer; padding: 0 4px; height: auto; }
.btn-link:hover { color: #d97a00; background: none; text-decoration: underline; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.input, select.input, textarea.input { height: 24px; border: 1px solid #b9c7d6; padding: 0 6px; border-radius: 2px; background: #fff; }
textarea.input { height: auto; padding: 4px 6px; }
.input:focus { border-color: var(--btn-blue); box-shadow: 0 0 0 2px rgba(60, 120, 195, .15); }
.input.req { border-color: var(--req-red); }
.form-item { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.form-item > label { min-width: 76px; text-align: right; color: #456; }
.form-item .req-star { color: var(--req-red); margin-left: 2px; }
.xbtn { display: inline-flex; width: 16px; height: 16px; border: 1px solid var(--btn-border); background: #f4f7fa; align-items: center; justify-content: center; cursor: pointer; border-radius: 2px; color: #678; }
.xbtn:hover { background: #e8eef5; color: var(--danger); }

/* ---------- 可搜索客户下拉（客户选择组件共用） ---------- */
.ct-menu { position: absolute; top: 26px; left: 0; right: 0; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow); z-index: 95; max-height: 216px; overflow: auto; }
.ct-mi { padding: 6px 10px; cursor: pointer; line-height: 1.5; font-size: 12px; }
.ct-mi:hover { background: var(--row-hover); }

/* ---------- 表格 ---------- */
table.grid { width: 100%; border-collapse: collapse; background: #fff; }
table.grid th, table.grid td { border: 1px solid var(--border-light); padding: 4px 8px; text-align: left; font-weight: normal; white-space: nowrap; }
table.grid th { background: var(--thead); color: var(--head-text); border-color: #b9cfе5; border-color: #bcd2e6; font-weight: 700; }
table.grid tr.alt td { background: var(--row-alt); }
table.grid tbody tr:hover td { background: var(--row-hover); }
table.grid tr.sel td { background: var(--row-sel); }
table.grid .num { text-align: right; }
table.grid .ctr { text-align: center; }
.total-row td { background: var(--total-bg) !important; font-weight: 700; color: #7a5b00; }
/* 列表表格横向滚动容器：内容超宽时左右滚动 */
.tbl-wrap { overflow-x: auto; }
.tbl-wrap table.grid { min-width: 100%; }
.empty-cell { text-align: center; color: var(--text-sub); padding: 18px 0 !important; }
.empty { text-align: center; color: var(--text-sub); padding: 32px 0; }
.empty .ic { display: block; margin: 0 auto 8px; opacity: .4; }

/* ---------- 左侧树 ---------- */
.side-wrap { display: flex; }
.side-tree { width: 200px; flex: none; background: #fff; border-right: 1px solid var(--border-light); overflow: auto; padding: 6px 0; }
.side-tree .tr-node { padding: 4px 8px; cursor: pointer; color: var(--link); display: flex; align-items: center; gap: 3px; white-space: nowrap; }
.side-tree .tr-node:hover { background: var(--row-hover); }
.side-tree .tr-node.on { background: #cfe3f7; font-weight: 700; color: #10406e; }
.tr-arrow { display: inline-flex; width: 14px; color: #89a; }
.main-flex { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- 详情键值表 ---------- */
table.form-tbl { width: 100%; border-collapse: collapse; }
table.form-tbl th, table.form-tbl td { border: 1px solid var(--border-light); padding: 5px 8px; }
table.form-tbl th { background: var(--label-bg); color: var(--head-text); font-weight: normal; width: 110px; text-align: right; }
table.form-tbl td { background: var(--value-bg); }
table.form-tbl th.th2 { width: 110px; }
.sec-title { margin: 10px 0 6px; padding-left: 8px; border-left: 3px solid var(--navy-500); color: var(--head-text); font-weight: 700; line-height: 16px; }

/* ---------- 页签 ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px 6px 0; background: #f6f9fc; border-bottom: 1px solid var(--border); }
.tab-it { padding: 5px 14px; background: #e8eef6; border: 1px solid var(--border); border-bottom: none; color: #456; cursor: pointer; position: relative; top: 1px; white-space: nowrap; }
.tab-it:hover { background: #f4f8fc; }
.tab-it.on { background: #fff; color: var(--head-text); font-weight: 700; padding-bottom: 6px; border-bottom: 1px solid #fff; }
.tab-acts { display: flex; gap: 4px; margin-left: auto; padding-bottom: 4px; }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 2px; font-size: 12px; line-height: 18px; }
.b-blue { background: #e8f2fd; color: #2b6cb0; }
.b-green { background: #e8f7ec; color: #3d8f43; }
.b-yellow { background: #fdf6d8; color: #9a6b00; }
.b-red { background: #fdeaea; color: #c9302c; }
.b-gray { background: #eef1f5; color: #6b7a8c; }
.lnk-days { display: inline-flex; align-items: center; gap: 3px; color: #6b7a8c; }
.lnk-days.warn { color: var(--danger); }

/* ---------- 审批人卡片 ---------- */
.apv-card { background: var(--apv-bg); border: 1px solid var(--apv-border); padding: 8px 10px; margin: 8px 0; line-height: 1.9; }
.apv-name { font-weight: 700; color: #4a3b00; display: flex; align-items: center; gap: 4px; }
.apv-ok { color: var(--warn); display: inline-flex; }
.apv-no { color: var(--danger); display: inline-flex; }
.apv-side-hd { background: linear-gradient(180deg, #f2f7fc, #e4eef8); border: 1px solid var(--border-light); padding: 5px 10px; font-weight: 700; color: var(--head-text); display: flex; align-items: center; justify-content: space-between; }
.apv-op label { color: #456; }
.apv-op textarea { width: 100%; border: 1px solid #b9c7d6; padding: 6px; margin-top: 4px; }
.apv-biz { font-weight: 700; color: var(--head-text); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }

/* ---------- 弹窗 ---------- */
.dlg-mask { position: fixed; inset: 0; background: rgba(15, 35, 60, .45); z-index: 90; display: flex; align-items: flex-start; justify-content: center; overflow: auto; padding: 30px 10px; }
.dlg { background: #f4f7fa; border: 1px solid #8fa8c0; box-shadow: 0 6px 24px rgba(10, 30, 60, .35); min-width: 420px; animation: dpop .16s ease; }
@keyframes dpop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.dlg-sm { width: 440px; }
.dlg-hd { display: flex; align-items: center; justify-content: space-between; padding: 7px 12px; background: linear-gradient(180deg, #2f5f8f, #24486e); color: #fff; font-weight: 700; font-size: 13px; }
.dlg-x { cursor: pointer; font-size: 18px; line-height: 14px; color: #dbe8f5; padding: 0 2px; font-weight: normal; }
.dlg-x:hover { color: #fff; }
.dlg-bd { padding: 12px 14px; background: #f4f7fa; }
.dlg-ft { padding: 8px 12px; border-top: 1px solid var(--border-light); text-align: right; display: flex; justify-content: flex-end; gap: 6px; background: #f4f7fa; }
.dlg-note { color: var(--text-sub); line-height: 24px; }
.dlg-full { width: 920px; max-width: 96vw; }

/* ---------- 职员选择器 ---------- */
.ep-left { width: 210px; flex: none; background: #fff; border-right: 1px solid var(--border-light); overflow: auto; }
.ep-title { padding: 6px 10px; background: #eef4fa; border-bottom: 1px solid var(--border-light); font-weight: 700; color: var(--head-text); }
.ep-right { flex: 1; min-width: 0; padding: 8px; }
.ep-filter { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.ep-pager { padding: 6px 0; text-align: center; }
#dlg-emp-picker table.grid th { text-align: center; }
#dlg-emp-picker table.grid td { cursor: pointer; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 3px; padding: 6px; background: #f6f9fc; border-top: 1px solid var(--border-light); flex-wrap: wrap; }
.pg-n { display: inline-block; min-width: 22px; height: 20px; line-height: 20px; text-align: center; border: 1px solid var(--btn-border); background: #fff; color: var(--link); padding: 0 4px; cursor: pointer; }
.pg-n:hover { background: var(--row-hover); text-decoration: none; }
.pg-n.on { background: var(--btn-blue); border-color: var(--btn-blue); color: #fff; font-weight: 700; }
.pg-info { color: var(--text-sub); margin-right: 6px; }
.pg-go input { width: 34px; height: 20px; border: 1px solid var(--btn-border); text-align: center; }
.pg-go .btn { height: 20px; padding: 0 6px; }

/* ---------- 提示 ---------- */
.toast { position: fixed; top: 56px; left: 50%; transform: translateX(-50%) translateY(-8px); background: #323e4d; color: #fff; padding: 8px 18px; border-radius: 3px; z-index: 99; opacity: 0; pointer-events: none; transition: all .22s; display: flex; align-items: center; gap: 6px; box-shadow: var(--shadow); font-size: 13px; max-width: 70vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #a83832; }
.tip-red { color: var(--req-red); line-height: 1.9; }
.hint-gray { color: var(--text-sub); line-height: 1.9; }

/* ---------- 登录页 ---------- */
.login-bg { min-height: 100vh; background: linear-gradient(180deg, #274d7d 0%, #3a6ba0 34%, #6d94bd 56%, #ffffff 56.2%); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.login-card { position: relative; width: 810px; max-width: 92vw; background: #fff; box-shadow: 0 10px 40px rgba(20, 45, 80, .3); padding: 26px 40px 20px; }
.login-company { font-size: 14px; color: #333; margin-bottom: 18px; }
.login-banner { height: 129px; border-radius: 2px; display: flex; align-items: stretch; overflow: hidden; color: #fff; font-size: 15px; letter-spacing: 1px; text-align: center; line-height: 2; margin-bottom: 18px; text-shadow: 0 1px 4px rgba(0,0,0,.3); }
.login-banner img { height: 100%; width: auto; max-width: 38%; object-fit: cover; flex: none; display: block; }
.login-banner .bt { flex: 1; display: flex; align-items: center; justify-content: center; padding: 0 22px; }
.login-form { display: flex; align-items: flex-start; gap: 26px; margin-bottom: 22px; }
.login-fields { flex: 1; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.login-fields input[type=text], .login-fields input[type=password] { width: 100%; height: 50px; border: 1px solid #ccd6e2; padding: 0 14px; font-size: 16px; box-sizing: border-box; }
.login-fields input:focus { border-color: var(--btn-blue); }
.login-btn { width: 150px; height: 38px; background: linear-gradient(180deg, #356ab0, #24508e); color: #fff; border: none; font-size: 15px; letter-spacing: 6px; cursor: pointer; flex: none; }
.login-btn:hover { background: linear-gradient(180deg, #3f78bd, #2a5a9c); }
.login-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; color: #789; }
.login-qr { width: 34px; height: 34px; border: 1px solid #ccd6e2; display: flex; align-items: center; justify-content: center; color: #9ab; }
.login-err { color: var(--req-red); height: 18px; line-height: 18px; font-size: 12px; }
.login-logo { position: fixed; top: 18px; left: 26px; color: #fff; font-size: 20px; font-weight: 700; font-style: italic; letter-spacing: 1px; z-index: 5; }
.login-logo small { font-size: 12px; font-weight: 600; margin-left: 6px; letter-spacing: 3px; opacity: .9; }

/* ---------- 手机端登录布局（移动设备/平板/窄窗口：JS 检测后给 html 加 login-mobile） ---------- */
html.login-mobile { overflow-x: hidden; }
html.login-mobile .login-bg { background: linear-gradient(180deg, #274d7d 0%, #3a6ba0 30%, #6d94bd 58%, #ffffff 58.2%); flex-direction: column; justify-content: flex-start; padding: 18px 16px 40px; box-sizing: border-box; }
html.login-mobile .login-logo { position: static; align-self: center; text-align: center; margin: 6px 0 26px; font-size: 22px; max-width: 100%; }
html.login-mobile .login-logo img { height: 26px !important; max-width: 120px !important; }
html.login-mobile .login-logo small { display: block; margin: 4px 0 0; letter-spacing: 6px; }
html.login-mobile .login-card { width: 100%; max-width: 420px; padding: 20px 18px 14px; box-sizing: border-box; }
html.login-mobile .login-banner { height: 96px; font-size: 13px; }
html.login-mobile .login-company { text-align: center; margin-bottom: 14px; }
html.login-mobile .login-form { flex-direction: column; gap: 16px; margin-bottom: 16px; }
html.login-mobile .login-fields { gap: 16px; }
html.login-mobile .login-fields input[type=text], html.login-mobile .login-fields input[type=password] { width: 100%; height: 59px; font-size: 18px; }
html.login-mobile .login-btn { width: 100%; height: 45px; letter-spacing: 10px; font-size: 16px; }

/* ---------- 富文本编辑器（装饰） ---------- */
.rte { border: 1px solid #b9c7d6; background: #fff; }
.rte-bar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 4px 6px; background: linear-gradient(180deg, #fdfdfd, #eef2f6); border-bottom: 1px solid var(--border-light); }
.rte-tb { width: 24px; height: 22px; display: flex; align-items: center; justify-content: center; border: 1px solid transparent; color: #46607e; cursor: pointer; font-size: 13px; font-weight: 700; }
.rte-tb:hover { border-color: var(--btn-border); background: #fff; }
.rte-area { min-height: 70px; padding: 8px; color: var(--text-sub); }

/* ---------- 主页 ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat-card { background: #fff; border: 1px solid var(--border); padding: 14px 16px; display: flex; gap: 12px; align-items: center; cursor: pointer; }
.stat-card:hover { box-shadow: var(--shadow); border-color: var(--navy-300); }
.stat-ic { width: 42px; height: 42px; border-radius: 3px; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.stat-num { font-size: 22px; font-weight: 700; color: var(--head-text); line-height: 1.2; }
.stat-lb { color: var(--text-sub); }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #b6c5d6; border-radius: 5px; border: 2px solid #eef2f7; }
::-webkit-scrollbar-thumb:hover { background: #9db1c8; }
::-webkit-scrollbar-track { background: #eef2f7; }
