:root {
  --primary: #2f6fed;
  --primary-d: #2456c8;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2733;
  --text-sub: #6b7686;
  --border: #e6eaf1;
  --danger: #e5484d;
  --ok: #1ba784;
  --warn: #f0a020;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(31, 39, 51, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
}
.hidden { display: none !important; }
a { color: var(--primary); text-decoration: none; }

/* 按钮 */
.btn { border: 1px solid var(--border); background: #fff; color: var(--text); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; transition: .15s; }
.btn:hover { border-color: #c9d2e0; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-sub); }
.btn-ghost:hover { background: rgba(0,0,0,.04); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 输入 */
.input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; color: var(--text); outline: none; }
.input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 64px; }

/* 登录 */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #2f6fed 0%, #5b8def 100%); }
.login-card { width: 360px; max-width: 92vw; background: #fff; border-radius: 16px; padding: 36px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.login-logo { font-size: 26px; font-weight: 700; text-align: center; color: var(--primary); }
.login-sub { text-align: center; color: var(--text-sub); margin: 6px 0 22px; font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-hint { margin-top: 16px; font-size: 12px; color: var(--text-sub); text-align: center; line-height: 1.6; }
.login-error { margin-top: 14px; padding: 9px 12px; font-size: 13px; color: #fff; background: var(--danger); border-radius: 8px; text-align: center; word-break: break-all; }
.fatal-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 9999; padding: 10px 16px; background: var(--danger); color: #fff; font-size: 13px; text-align: center; }

/* 布局 */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 20; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; color: var(--primary); padding: 16px 18px; border-bottom: 1px solid var(--border); }
.sidebar-brand .brand-logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--primary), #5b8def); color: #fff; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.sidebar-brand .brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 侧栏导航：模块 > 子模块 树形结构 */
.nav { flex: 1; overflow-y: auto; padding: 8px 8px 16px; }
.nav::-webkit-scrollbar { width: 8px; }
.nav::-webkit-scrollbar-thumb { background: #e1e6ef; border-radius: 8px; }
.nav-mod { margin: 1px 0; }
.nav-mod-head {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 9px; cursor: pointer; color: var(--text);
  font-weight: 600; font-size: 13.5px; user-select: none; transition: background .15s;
}
.nav-mod-head:hover { background: #eef2fb; }
.nav-mod-head .nav-ico { width: 18px; height: 18px; color: var(--primary); flex: 0 0 auto; display: flex; }
.nav-mod-head .nav-mod-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-mod-head .nav-caret { width: 16px; height: 16px; color: var(--text-sub); flex: 0 0 auto; transition: transform .22s ease; }
.nav-mod[data-open="0"] .nav-caret { transform: rotate(-90deg); }
.nav-mod-body {
  max-height: 1600px; overflow: hidden; opacity: 1; margin: 1px 0 6px 19px; padding-left: 4px;
  border-left: 1px solid var(--border); transition: max-height .28s ease, opacity .2s ease, margin .2s ease;
}
.nav-mod[data-open="0"] .nav-mod-body { max-height: 0; opacity: 0; margin-top: 0; margin-bottom: 0; }
.nav-link {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; margin: 1px 0;
  border-radius: 7px; color: var(--text-sub); cursor: pointer; font-size: 13px;
  position: relative; transition: background .15s, color .15s;
}
.nav-link:hover { background: #eef2fb; color: var(--text); }
.nav-link.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-link .nl-ico { width: 15px; height: 15px; flex: 0 0 auto; opacity: .85; display: flex; }
.nav-link.active .nl-ico { color: #fff; opacity: 1; }
.nav-link--data .nl-ico { color: var(--text-sub); opacity: .6; }
.nav-link .nl-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-link--approve::before {
  content: ''; position: absolute; left: 2px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--warn);
}
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.user-chip { font-size: 13px; color: var(--text-sub); margin-bottom: 8px; }
.user-chip b { color: var(--text); }

.content { flex: 1; margin-left: 240px; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 56px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 18px; gap: 12px; position: sticky; top: 0; z-index: 10; }
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-right { margin-left: auto; color: var(--text-sub); font-size: 13px; }
.view { padding: 18px; flex: 1; min-height: 0; position: relative; }
/* 深度合并：当内容区承载多维表格引擎时，铺满整块并去掉留白 */
.view:has(.mdb-app), .view.view-mdb { padding: 0; display: flex; flex-direction: column; }

/* 数据中心（多维表格）侧栏子项现已并入统一导航树，复用 .nav-link / .nav-link--data，旧 mdb-* 类已废弃 */

/* 卡片/网格 */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .lbl { color: var(--text-sub); font-size: 13px; margin-top: 4px; }

/* ===== 总览页（工作台>总览） ===== */
.ov-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: linear-gradient(120deg, #2f6fed, #5b8def); color: #fff; border-radius: 14px; padding: 20px 22px; margin-bottom: 16px; box-shadow: 0 6px 20px rgba(47, 111, 237, .18); }
.ov-greet { font-size: 20px; font-weight: 700; }
.ov-sub { font-size: 13px; opacity: .92; margin-top: 4px; }
.ov-badge { display: inline-flex; align-items: center; gap: 7px; background: rgba(255, 255, 255, .16); padding: 7px 12px; border-radius: 999px; font-size: 13px; white-space: nowrap; }
.ov-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #7CFC9B; box-shadow: 0 0 0 3px rgba(124, 252, 155, .3); }
@media (max-width: 600px) { .ov-hero { flex-direction: column; align-items: flex-start; } }

.ov-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
@media (max-width: 900px) { .ov-kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .ov-kpis { grid-template-columns: 1fr; } }
.kpi { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.kpi-ico { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; color: #fff; }
.kpi--blue .kpi-ico { background: linear-gradient(135deg, #2f6fed, #5b8def); }
.kpi--red .kpi-ico { background: linear-gradient(135deg, #ef5350, #ff7676); }
.kpi--green .kpi-ico { background: linear-gradient(135deg, #2bb673, #52c79a); }
.kpi--orange .kpi-ico { background: linear-gradient(135deg, #f59e0b, #fbbf4d); }
.kpi-body { min-width: 0; }
.kpi-num { font-size: 24px; font-weight: 700; line-height: 1.1; }
.kpi-lbl { font-size: 13px; color: var(--text-sub); margin-top: 2px; }
.kpi-sub { font-size: 12px; color: var(--text-sub); margin-top: 3px; opacity: .85; }

.ov-cols { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
@media (max-width: 980px) { .ov-cols { grid-template-columns: 1fr; } }
.ov-main, .ov-side { display: flex; flex-direction: column; }

.oblock { margin-bottom: 16px; }
.oblock:last-child { margin-bottom: 0; }
.oblock-h { font-size: 13px; color: var(--text-sub); margin-bottom: 8px; }
.obar-track { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--bg); }
.obar-seg { display: block; }
.obar--red { background: #ef5350; } .obar--orange { background: #f59e0b; } .obar--green { background: #2bb673; } .obar--blue { background: #2f6fed; } .obar--gray { background: #9aa4b2; }
.obar-empty { margin: auto; font-size: 12px; color: var(--text-sub); }
.obar-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--text-sub); }
.obar-leg { display: inline-flex; align-items: center; gap: 6px; }
.obar-leg b { color: var(--text); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot--red { background: #ef5350; } .dot--orange { background: #f59e0b; } .dot--green { background: #2bb673; } .dot--blue { background: #2f6fed; } .dot--gray { background: #9aa4b2; }

.todo-it { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 9px; cursor: pointer; transition: .15s; text-decoration: none; color: inherit; }
.todo-it:last-child { margin-bottom: 0; }
.todo-it:hover { border-color: var(--primary); background: #f5f8ff; }
.todo-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.todo-dot--red { background: #ef5350; } .todo-dot--orange { background: #f59e0b; } .todo-dot--blue { background: #2f6fed; }
.todo-lbl { flex: 1; font-size: 14px; }
.todo-n { font-weight: 700; font-size: 14px; }
.todo-it--hot .todo-n { color: #ef5350; }

.mini-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.mini { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.mini .mn { font-size: 20px; font-weight: 700; }
.mini .ml { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.mini--green .mn { color: #2bb673; } .mini--blue .mn { color: #2f6fed; } .mini--gray .mn { color: #6b7686; }

/* 标签 */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 1.7; white-space: nowrap; border: 1px solid transparent; border-color: color-mix(in srgb, currentColor 22%, transparent); }
.tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.tag-pending { background: #fff3e0; color: #c77700; }
.tag-doing { background: #e7f0ff; color: #2f6fed; }
.tag-done { background: #e6f7f1; color: var(--ok); }
.tag-reject { background: #fdeaea; color: var(--danger); }
.tag-default { background: #eef1f6; color: var(--text-sub); }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-sub); font-weight: 600; background: #fafbfe; }
.table tr:hover td { background: #f7f9fd; }

/* 工具栏 */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 模态框 */
.modal-mask { position: fixed; inset: 0; background: rgba(20,28,40,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 440px; max-width: 96vw; max-height: 90vh; overflow-y: auto; padding: 20px; }
.modal-lg { width: 560px; }
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 14px; }
.modal-body { display: flex; flex-direction: column; gap: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* 表单组 */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 13px; color: var(--text-sub); }

/* toast */
.ui-toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px); background: rgba(31,39,51,.92); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 200; max-width: 80vw; }
.ui-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ui-toast.error { background: var(--danger); }

.empty { text-align: center; color: var(--text-sub); padding: 40px 0; }

/* 多维数据中心：内嵌 iframe 充满内容区（位于顶栏之下、侧栏之右） */
.mdb-frame-wrap { position: fixed; left: 220px; right: 0; top: 56px; bottom: 0; background: #fff; z-index: 5; }
.mdb-frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
@media (max-width: 760px) {
  .mdb-frame-wrap { left: 0; }
}

/* 移动端 */
.only-mobile { display: none; }
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: .2s; width: 240px; }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; }
  .only-mobile { display: inline-block; }
}

/* 资产页视图切换（资产台账 / 调拨记录） */
.tabs-bar { display: flex; gap: 8px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.tb-btn {
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--text-sub); font-size: 14px; padding: 9px 16px; cursor: pointer;
  transition: .15s;
}
.tb-btn:hover { color: var(--text); }
.tb-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* 报修台账统计卡 */
.stat-row { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.stat-card {
  flex: 1; min-width: 90px; text-align: center; padding: 12px 8px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--border-radius-md, 8px);
}
.stat-card .sc-num { font-size: 22px; font-weight: 500; color: var(--text); line-height: 1.2; }
.stat-card .sc-label { font-size: 12px; color: var(--text-sub); margin-top: 3px; }

/* 权限三态选择（继承 / 允许 / 禁止） */
.perm-tri { display: flex; gap: 4px; }
.perm-tri .pt {
  flex: 1; text-align: center; font-size: 12px; padding: 4px 2px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 6px; color: var(--text-sub);
  background: var(--bg); user-select: none;
}
.perm-tri .pt input { display: none; }
.perm-tri .pt.on { border-color: var(--primary); color: #fff; background: var(--primary); }
.perm-tri .pt.on:last-child { border-color: #e5484d; background: #e5484d; }
/* 列表中的「自定义」标记，提示该用户有单独配置 */
.badge {
  display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px;
  background: var(--primary); color: #fff; vertical-align: middle;
}
.muted-lock {
  display: inline-block; font-size: 13px; color: var(--text-sub);
  background: #f2f4f8; border: 1px solid #e3e7ef; border-radius: 4px; padding: 2px 8px;
  white-space: nowrap;
}

/* ===== 审批中心：分类 tab + 审批卡片 ===== */
.tabbar { display: flex; flex-wrap: wrap; gap: 8px; }
.tab { background: var(--bg); border: 1px solid var(--border); color: var(--text-sub); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab .badge { background: #fff; color: var(--primary); margin-left: 4px; }
.tab.active .badge { background: rgba(255,255,255,.28); color: #fff; }
.approval-list { margin-top: 14px; }
.approval-card { padding: 14px; }
.appr-type { display: inline-block; font-size: 12px; color: var(--primary); background: #eef3ff; border-radius: 4px; padding: 2px 8px; margin-bottom: 6px; }
.appr-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.appr-meta { font-size: 13px; color: var(--text-sub); margin-bottom: 10px; line-height: 1.5; }
.appr-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nav-approve { color: var(--primary); font-weight: 500; }

/* ===== 业务流程：步骤图 ===== */
.flow-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 8px; }
.flow-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: var(--bg); }
.flow-title { font-weight: 600; margin-bottom: 12px; color: var(--text); }
.flow-steps { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 4px; }
.flow-step { display: flex; flex-direction: column; align-items: center; min-width: 56px; text-align: center; }
.flow-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary); margin-bottom: 6px; }
.flow-name { font-size: 12px; color: var(--text); }
.flow-n { font-size: 13px; font-weight: 600; color: var(--primary); margin-top: 2px; }
.flow-arrow { color: var(--text-sub); font-size: 16px; line-height: 30px; padding: 0 2px; }
