/* ============ 客户服务管理系统 - 全局样式 v2（浅色精致版） ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-deep: #312e81;
  --primary-light: #eef2ff;
  --violet: #7c3aed;
  --danger: #e11d48;
  --success: #059669;
  --warning: #d97706;
  --text: #1e293b;
  --text-light: #64748b;
  --text-faint: #94a3b8;
  --border: #e6e8f0;
  --bg: #f4f5fa;
  --card-radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 16px rgba(50, 46, 168, .08);
  --sidebar-w: 236px;
}
html, body { height: 100%; font-family: "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif; color: var(--text); font-size: 14px; background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ---- 布局：浅色侧边栏 ---- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--border); flex-shrink: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .logo { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; }
.logo-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 100%); color: #fff; font-weight: 700; font-size: 17px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(79, 70, 229, .35); flex-shrink: 0; }
.logo-text { line-height: 1.25; }
.logo-text b { font-size: 15px; color: var(--text); display: block; }
.logo-text small { font-size: 11px; color: var(--text-faint); }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.nav-group { padding: 14px 10px 6px; font-size: 11px; color: var(--text-faint); font-weight: 600; letter-spacing: 2px; }
.nav-item { display: block; padding: 9px 12px; color: #475569; cursor: pointer; border-radius: 10px; font-size: 13.5px; margin-bottom: 2px; transition: all .15s; }
.nav-item:hover { color: var(--primary); background: #f4f5fb; }
.nav-item.active { color: var(--primary); background: var(--primary-light); font-weight: 600; box-shadow: inset 0 0 0 1px #dfe3fd; }
.sidebar .footer { padding: 14px 18px; font-size: 11px; color: var(--text-faint); border-top: 1px solid var(--border); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* 顶栏：悬浮圆角条 */
.topbar { margin: 16px 24px 0; background: #fff; border: 1px solid var(--border); border-radius: 12px; height: 50px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; box-shadow: var(--shadow-sm); position: sticky; top: 12px; z-index: 20; }
.topbar .crumb { color: var(--text-light); font-size: 13px; }
.topbar .user-info { display: flex; align-items: center; gap: 10px; }
.topbar .user-info .role-tag { background: var(--primary-light); color: var(--primary); padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.content { flex: 1; padding: 18px 24px 28px; overflow-y: auto; }

/* ---- 通用 ---- */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--card-radius); padding: 18px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.card h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; justify-content: flex-start; }
.card h3 > .btn { margin-left: auto; }
.card h3 > .btn ~ .btn { margin-left: 8px; }
.card h3::before { content: ''; width: 4px; height: 16px; border-radius: 2px; background: linear-gradient(180deg, #6366f1, var(--primary)); margin-right: 10px; flex-shrink: 0; }
.card h3 > :first-child { flex: 0 1 auto; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.toolbar .spacer { flex: 1; }
table.tbl { width: 100%; border-collapse: collapse; background: #fff; }
.tbl th { text-align: left; padding: 10px 12px; color: var(--text-faint); font-weight: 600; font-size: 12px; letter-spacing: .5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid #f1f2f7; vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: #f8f9fe; }
.tbl .ops { white-space: nowrap; }
.tbl .ops button { margin-right: 4px; }

.btn { border: 1px solid var(--border); background: #fff; color: #475569; border-radius: 9px; padding: 7px 14px; font-size: 13px; transition: all .15s; font-weight: 500; }
.btn:hover { border-color: #c7cdf8; color: var(--primary); background: #fafbff; }
.btn.primary { background: linear-gradient(135deg, var(--primary), #6366f1); border: none; color: #fff; box-shadow: 0 2px 8px rgba(79, 70, 229, .3); }
.btn.primary:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); box-shadow: 0 4px 12px rgba(79, 70, 229, .4); }
.btn.danger { color: var(--danger); border-color: #fecdd3; }
.btn.danger:hover { background: #fff1f2; }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.input, select.input, textarea.input { border: 1px solid var(--border); border-radius: 9px; padding: 7px 11px; font-size: 13px; font-family: inherit; outline: none; background: #fff; color: var(--text); transition: border .15s, box-shadow .15s; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.input.w-sm { width: 130px; } .input.w-md { width: 200px; } .input.w-full { width: 100%; }
textarea.input { resize: vertical; }
label.fld { display: block; margin-bottom: 10px; font-size: 13px; }
label.fld .t { display: block; margin-bottom: 4px; color: var(--text-light); }
label.fld .t b.red { color: var(--danger); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; line-height: 18px; white-space: nowrap; font-weight: 500; }
.badge.gray { background: #f1f5f9; color: var(--text-light); }
.badge.blue { background: var(--primary-light); color: var(--primary); }
.badge.green { background: #ecfdf5; color: var(--success); }
.badge.red { background: #fff1f2; color: var(--danger); }
.badge.orange { background: #fffbeb; color: var(--warning); }
.badge.purple { background: #f5f3ff; color: var(--violet); }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--text-light); font-size: 13px; }
.empty { text-align: center; color: var(--text-faint); padding: 44px 0; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(30, 27, 75, .4); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 16px; width: 560px; max-width: 94vw; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(30, 27, 75, .25); }
.modal.wide { width: 760px; }
.modal.xwide { width: 680px; max-height: none; }
.modal.xwide .body { overflow-y: visible; }
.modal header { padding: 16px 20px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); font-size: 15px; }
.modal header .x { cursor: pointer; color: var(--text-faint); font-size: 20px; line-height: 1; }
.modal header .x:hover { color: var(--danger); }
.modal .body { padding: 20px; overflow-y: auto; }
.modal footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: #fafbff; border-radius: 0 0 16px 16px; }

/* 表单网格 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* 详情字段 */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 20px; background: #f8f9fe; border: 1px solid #eef0f7; border-radius: 12px; padding: 16px; }
.detail-grid .item .k { font-size: 12px; color: var(--text-faint); margin-bottom: 3px; }
.detail-grid .item .v { font-size: 13.5px; font-weight: 500; }

/* 时间线 */
.timeline { border-left: 2px solid #e4e6f2; margin-left: 8px; padding-left: 20px; }
.timeline .tl-item { position: relative; padding-bottom: 18px; }
.timeline .tl-item::before { content: ''; position: absolute; left: -26px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); }
.timeline .tl-item .tl-head { font-size: 13px; font-weight: 600; }
.timeline .tl-item .tl-time { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.timeline .tl-item .tl-body { font-size: 13px; margin-top: 4px; color: #475569; background: #f8f9fe; border-radius: 8px; padding: 6px 10px; }

/* 工作台统计卡片 */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { position: relative; background: #fff; border: 1px solid var(--border); border-radius: var(--card-radius); padding: 16px 16px 14px; box-shadow: var(--shadow-sm); overflow: hidden; }
.stat-card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--primary), #818cf8); }
.stat-card.warn::after { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat-card.bad::after { background: linear-gradient(90deg, #e11d48, #fb7185); }
.stat-card.ok::after { background: linear-gradient(90deg, #059669, #34d399); }
.stat-card .num { font-size: 27px; font-weight: 700; margin-top: 6px; color: var(--primary-deep); letter-spacing: -.5px; }
.stat-card.warn .num { color: var(--warning); }
.stat-card.bad .num { color: var(--danger); }
.stat-card.ok .num { color: var(--success); }
.stat-card .lbl { font-size: 12px; color: var(--text-light); }

/* 登录页：分栏品牌式 */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background:
  radial-gradient(1200px 600px at 10% -10%, #e0e7ff 0%, transparent 55%),
  radial-gradient(900px 500px at 110% 110%, #ede9fe 0%, transparent 50%), var(--bg); padding: 24px; }
.login-shell { display: grid; grid-template-columns: 1.15fr 1fr; width: 920px; max-width: 100%; border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px rgba(49, 46, 129, .25); }
.login-brand { background: linear-gradient(155deg, var(--primary-deep) 0%, var(--primary) 55%, var(--violet) 100%); color: #fff; padding: 52px 46px; display: flex; flex-direction: column; }
.login-brand .brand-mark { width: 52px; height: 52px; border-radius: 15px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; margin-bottom: 26px; }
.login-brand h1 { font-size: 25px; margin-bottom: 8px; letter-spacing: 1px; }
.login-brand .brand-sub { font-size: 13px; opacity: .78; margin-bottom: 40px; }
.brand-features { list-style: none; display: flex; flex-direction: column; gap: 15px; }
.brand-features li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; opacity: .92; line-height: 1.5; }
.brand-features li::before { content: '✓'; width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, .18); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; margin-top: 1px; }
.login-brand .brand-foot { margin-top: auto; font-size: 12px; opacity: .55; }
.login-box { background: #fff; padding: 44px 42px; }
.login-box h2 { font-size: 19px; margin-bottom: 4px; }
.login-box .sub { color: var(--text-light); font-size: 13px; margin-bottom: 24px; }
.login-box .err { background: #fff1f2; color: var(--danger); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px; }
@media (max-width: 880px) { .login-shell { grid-template-columns: 1fr; } .login-brand { display: none; } }

/* 演示账号一键登录 */
.demo-login { margin-top: 22px; border-top: 1px dashed var(--border); padding-top: 16px; }
.demo-login .demo-title { font-size: 12px; color: var(--text-faint); text-align: center; margin-bottom: 10px; }
.demo-login .demo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.demo-btn { border: 1px solid var(--border); background: #fff; border-radius: 10px; padding: 9px 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; transition: all .15s; }
.demo-btn:hover { border-color: #c7cdf8; background: var(--primary-light); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.demo-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.demo-btn .r { font-size: 12px; color: var(--primary); font-weight: 600; }
.demo-btn .n { font-size: 11px; color: var(--text-faint); }

/* 简易柱状图 */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 96px; padding-top: 6px; }
.bars .bar { flex: 1; background: linear-gradient(180deg, #a5b4fc, #6366f1); border-radius: 4px 4px 0 0; min-height: 3px; position: relative; }
.bars .bar:hover { background: linear-gradient(180deg, var(--primary), var(--primary-dark)); }
.bars .bar .tip { display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--primary-deep); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 5px; white-space: nowrap; margin-bottom: 4px; }
.bars .bar:hover .tip { display: block; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mb8 { margin-bottom: 8px; }
.muted { color: var(--text-light); font-size: 12px; }
.link { color: var(--primary); cursor: pointer; font-weight: 500; }
.link:hover { text-decoration: underline; }

/* 标签编辑器（客户表单） */
.tag-editor { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 34px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 9px; background: #fff; }
.tag-editor:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-light); color: var(--primary); border-radius: 999px; padding: 2px 6px 2px 10px; font-size: 12px; line-height: 18px; white-space: nowrap; font-weight: 500; }
.tag-chip .tag-x { cursor: pointer; font-style: normal; color: #a5b4fc; font-size: 13px; line-height: 1; padding: 1px 3px; border-radius: 50%; }
.tag-chip .tag-x:hover { color: #fff; background: var(--primary); }
.tag-add { width: 24px; height: 24px; border-radius: 50%; border: 1px dashed #c7cdf8; background: #fafbff; color: var(--primary); font-size: 14px; line-height: 1; cursor: pointer; }
.tag-add:hover { border-style: solid; background: var(--primary-light); }
.tag-picker-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip.pick { cursor: pointer; background: #f1f5f9; color: var(--text-light); padding: 4px 10px; }
.tag-chip.pick:hover { border: 1px solid #c7cdf8; background: var(--primary-light); color: var(--primary); }
.tag-chip.pick.picked { background: var(--primary-light); color: var(--primary); border: 1px solid #c7cdf8; }

/* 布尔字段（服务信息自定义字段） */
.bool-field { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 2px; }
.bool-field input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.bool-field label { font-size: 13px; color: var(--text); cursor: pointer; }

/* 中控台同步：部门树 */
.dep-tree { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.dep-node { display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-size: 13px; cursor: pointer; border-radius: 6px; }
.dep-node:hover { background: #f8f9fe; }
.dep-node input[type="checkbox"] { accent-color: var(--primary); }

/* 审批链区块（含链内发起人设置） */
.flow-section { border: 1px solid var(--border); border-radius: 12px; padding: 4px 14px 14px; margin-top: 12px; background: #fafbff; }

/* SSO 登录按钮 */
.sso-btn { display: block; text-align: center; padding: 12px !important; font-size: 15px; text-decoration: none; }
.sso-tip { margin-top: 14px; font-size: 12px; color: var(--text-faint); text-align: center; line-height: 1.6; }

/* 组织架构双栏 */
.org-layout { display: flex; align-items: flex-start; gap: 0; }
.org-side { flex: none; width: 235px; border-right: 1px solid var(--border); padding: 8px 0; min-height: 300px; }
.org-side .org-dep, .org-side-head { max-width: 100%; }
.org-side .org-dep:last-child { border-bottom: none; }
.org-side-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px 8px; font-size: 12px; font-weight: 600; color: #94a3b8; letter-spacing: 1px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.org-dep { display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer; color: #475569; border-radius: 6px; margin: 1px 10px; }
.org-dep:hover { background: #f4f6f9; color: var(--primary); }
.org-dep.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.org-dep-root { font-weight: 600; color: #1e293b; }
.org-dep.child::before { content: ''; width: 12px; height: 1px; background: #cbd5e1; flex: none; margin-left: -14px; margin-right: 2px; }
/* 层级图标：一级=圆角方块，二级=菱形，三级及以上=圆点 */
.dep-ic { flex: none; margin-right: 7px; }
.dep-ic.ic0 { width: 9px; height: 9px; border-radius: 3px; background: #64748b; }
.dep-ic.ic1 { width: 7px; height: 7px; border-radius: 2px; background: #94a3b8; transform: rotate(45deg); }
.dep-ic.ic2 { width: 5px; height: 5px; border-radius: 50%; background: #cbd5e1; }
.org-dep.active .dep-ic.ic0 { background: var(--primary); }
.org-dep.active .dep-ic.ic1 { background: var(--primary); opacity: .7; }
.org-dep.active .dep-ic.ic2 { background: var(--primary); opacity: .5; }
.dep-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-count { flex: none; min-width: 18px; text-align: center; font-size: 11px; padding: 3px 6px; border-radius: 999px; background: #e6ebf2; color: #64748b; }
.org-dep.active .dep-count { background: var(--primary); color: #fff; }
.dep-ops { display: none; flex: none; }
.org-dep:hover .dep-ops { display: inline-flex; gap: 2px; }
.org-dep:hover .dep-count { display: none; }
.dep-ops button { border: none; background: none; cursor: pointer; font-size: 12px; color: #94a3b8; padding: 2px 3px; border-radius: 4px; }
.dep-ops button:hover { color: var(--primary); background: #eef2f7; }
.dep-ops button:last-child:hover { color: var(--danger); }
.org-main { padding-left: 16px; min-width: 0; flex: 1; overflow-x: auto; }
.org-main table { table-layout: auto; }
/* 员工行操作按钮：默认隐藏，行悬停时显示（与部门栏一致） */
.org-main .org-ops .btn { display: none; }
.org-main tr:hover .org-ops .btn { display: inline-block; margin-right: 2px; }
.org-main .org-ops { width: 46px; text-align: right; }

/* 部门列超长省略（部门名可能很长） */
.cell-dept { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-ellipsis { display: inline-block; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }

/* 左栏头部“全部员工”按钮 */
.org-side-head .btn.on { background: var(--primary-light); color: var(--primary); font-weight: 600; }


/* 顶部二级Tab导航 */
.topbar .tabs { display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; }
.topbar .tab-root { font-weight: 700; font-size: 14px; color: #1e293b; margin-right: 6px; white-space: nowrap; }
.topbar .tabs a.tab { padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--text-light); font-size: 13px; white-space: nowrap; transition: all .15s; }
.topbar .tabs a.tab:hover { background: #f4f6f9; color: var(--primary); }
.topbar .tabs a.tab.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-top { display: flex; align-items: center; justify-content: space-between; font-size: 14px; padding: 11px 12px; }
.nav-arrow { color: var(--text-faint); font-size: 15px; }
.nav-top:hover .nav-arrow, .nav-top.active .nav-arrow { color: var(--primary); }

/* 侧栏一级菜单图标 */
.nav-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.nav-ic { display: inline-flex; width: 17px; height: 17px; color: #94a3b8; flex: none; transition: color .15s; }
.nav-ic svg { width: 100%; height: 100%; }
.nav-item:hover .nav-ic, .nav-item.active .nav-ic { color: var(--primary); }

/* 角色与权限页 */
.perm-layout { display: flex; align-items: flex-start; gap: 20px; }
.perm-roles { flex: none; width: 170px; border-right: 1px solid var(--border); padding-right: 14px; }
.perm-role { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; color: #475569; margin-bottom: 2px; }
.perm-role:hover { background: #f4f6f9; color: var(--primary); }
.perm-role.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.perm-lock { font-size: 12px; }
.perm-detail { flex: 1; min-width: 0; }
.perm-detail h4 { margin: 16px 0 8px; font-size: 13.5px; }
.perm-menus { display: flex; flex-wrap: wrap; gap: 10px 24px; background: #f8f9fe; border: 1px solid #eef0f7; border-radius: 10px; padding: 12px 16px; }
.perm-menu-group { min-width: 140px; }
.perm-menu-title { font-size: 12px; color: var(--text-faint); font-weight: 600; margin-bottom: 6px; }
.perm-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #475569; padding: 3px 0; cursor: pointer; }
.perm-check.inline { display: inline-flex; margin: 0 12px 6px 0; }
.perm-data { background: #f8f9fe; border: 1px solid #eef0f7; border-radius: 10px; padding: 10px 16px; display: flex; gap: 18px; }
.perm-pick { background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 10px 14px; margin-top: 10px; max-height: 180px; overflow-y: auto; }

/* 角色与权限 v2：菜单-操作联动 */
.perm-role-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.perm-menu-item { margin-bottom: 10px; }
.perm-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0 24px; }
.perm-chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: #eef2f7; color: #94a3b8; cursor: pointer; border: 1px solid transparent; user-select: none; }
.perm-chip.on { background: var(--primary-light); color: var(--primary); border-color: #dfe3fd; font-weight: 600; }
.perm-chip:hover { color: var(--primary); }

/* 工单/任务 进度步骤条 */
.steps { display: flex; align-items: center; gap: 0; margin: 4px 0 10px; }
.step { display: flex; align-items: center; flex: 1; }
.step .dot { width: 26px; height: 26px; border-radius: 50%; background: #e2e8f0; color: #94a3b8; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex: none; }
.step .lbl { font-size: 12px; color: #94a3b8; margin-left: 6px; white-space: nowrap; }
.step .bar { flex: 1; height: 2px; background: #e2e8f0; margin: 0 8px; }
.step.done .dot { background: var(--primary); color: #fff; }
.step.done .lbl { color: var(--primary); }
.step.done .bar { background: var(--primary); }
.step.current .dot { background: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--primary-light); }
.step.current .lbl { color: var(--primary); font-weight: 600; }
.step.rejected .dot { background: var(--danger); color: #fff; }
.step.rejected .lbl { color: var(--danger); font-weight: 600; }

/* ============ 响应式改造（HTML5 / 多终端适配） ============ */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { -webkit-tap-highlight-color: transparent; }
a, button, select, label, .tab, .nav-item { touch-action: manipulation; }
img, svg { max-width: 100%; }

/* 汉堡按钮（桌面隐藏）与侧栏遮罩 */
.nav-toggle { display: none; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--border); background: #fff; border-radius: 10px; color: #475569; flex: none; }
.nav-toggle:active { background: var(--primary-light); color: var(--primary); }
.nav-toggle svg { width: 20px; height: 20px; }
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.sidebar-mask { display: none; }

/* ---- 平板 ≤1024px：侧栏收为抽屉 ---- */
@media (max-width: 1024px) {
  .nav-toggle { display: inline-flex; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100vh; height: 100dvh; z-index: 60; width: min(var(--sidebar-w), 82vw); transform: translateX(-105%); transition: transform .22s ease; box-shadow: 0 0 44px rgba(30, 27, 75, .22); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask { display: block; position: fixed; inset: 0; background: rgba(30, 27, 75, .38); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sidebar-mask.show { opacity: 1; pointer-events: auto; }
  .topbar { margin: 12px 16px 0; top: 8px; padding: 0 12px; }
  .content { padding: 14px 16px 24px; }
  /* 宽表格在卡片内横向滚动，避免压碎布局 */
  .card, .modal .body { overflow-x: auto; }
}

/* ---- 手机 ≤768px ---- */
@media (max-width: 768px) {
  .content { padding: 12px 10px 22px; }
  .topbar { margin: 10px 10px 0; height: 46px; padding: 0 8px 0 6px; border-radius: 10px; }
  .topbar .tabs { gap: 2px; }
  .topbar .tabs a.tab { padding: 6px 9px; font-size: 12.5px; }
  .topbar .tab-root { font-size: 13px; margin-right: 2px; }
  .topbar .user-info { gap: 6px; }
  .card { padding: 13px; border-radius: 12px; }

  /* 表单：单列排布 */
  .form-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr 1fr; padding: 12px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card .num { font-size: 22px; }

  /* 触控友好：加高输入与按钮（同时规避 iOS 聚焦自动放大） */
  .input, select.input, textarea.input { font-size: 16px; padding: 9px 12px; border-radius: 9px; }
  .input.w-sm, .input.w-md { width: 100%; max-width: 220px; }
  label.fld { font-size: 14px; }
  .btn { padding: 9px 16px; min-height: 38px; font-size: 14px; }
  .btn.sm { padding: 6px 12px; min-height: 32px; font-size: 13px; }
  .toolbar { gap: 6px; }

  /* 表格：小屏横向滚动 + 紧凑 */
  .tbl { min-width: 480px; }
  .tbl th { padding: 8px 9px; }
  .tbl td { padding: 9px; font-size: 13px; }
  .org-layout, .perm-layout { flex-direction: column; }
  .org-side { width: 100%; border-right: none; border-bottom: 1px solid var(--border); min-height: 0; max-height: 260px; overflow-y: auto; padding-bottom: 6px; }
  .org-main { padding-left: 0; width: 100%; }
  .perm-roles { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 0 0 10px; }

  /* 弹窗：移动端全屏化 */
  .modal-mask { align-items: stretch; padding: 0; }
  .modal, .modal.wide, .modal.xwide { width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
  .modal .body { padding: 14px; flex: 1; }
  .modal.xwide .body { overflow-y: auto; }
  .modal footer { position: sticky; bottom: 0; border-radius: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .modal header { padding: 13px 16px; position: sticky; top: 0; background: #fff; z-index: 2; }

  .login-page { padding: 12px; align-items: flex-start; }
  .login-box { padding: 26px 22px; }
  .pager { justify-content: center; flex-wrap: wrap; }
}

/* ---- 小屏手机 ≤480px ---- */
@media (max-width: 480px) {
  .topbar .role-tag { display: none; }
  .topbar .user-name { font-size: 13px; }
  .detail-grid { grid-template-columns: 1fr; }
  .demo-login .demo-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .card h3 { font-size: 14px; flex-wrap: wrap; row-gap: 6px; }
  .tbl { min-width: 430px; }
  .modal footer .btn { flex: 1; }
  .sidebar { width: 86vw; }
}

/* ---- 窄桌面 1025-1200px：侧栏与留白微调 ---- */
@media (min-width: 1025px) and (max-width: 1200px) {
  :root { --sidebar-w: 208px; }
  .content { padding: 16px 18px 26px; }
  .topbar { margin: 12px 16px 0; }
}
