/* ===== MES+ERP+CRM 全流程管理系统 · 样式 ===== */

/* 主题色 */
:root {
  --bg:           #f3f6fb;
  --panel:        #ffffff;
  --text:         #1f2937;
  --text-soft:    #4b5563;
  --text-mute:    #9ca3af;
  --border:       #e5e7eb;
  --primary:      #1e3a8a;
  --primary-2:    #1e40af;
  --primary-3:    #2563eb;
  --primary-soft: #dbeafe;
  --accent:       #06b6d4;

  --ok:           #22c55e;
  --warn:         #f59e0b;
  --err:          #ef4444;
  --view:         #fbbf24;   /* 眼睛标识 */

  --shadow-sm:    0 1px 3px rgba(15,23,42,.06);
  --shadow-md:    0 4px 16px rgba(15,23,42,.08);
  --shadow-lg:    0 12px 32px rgba(15,23,42,.12);
  --radius:       12px;
  --radius-lg:    18px;
  --r-icon:       14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* ===== 顶部导航 ===== */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: 60px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-3) 100%);
  color: #fff;
  display: flex; align-items: center;
  padding: 0 24px;
  box-shadow: var(--shadow-md);
}
.topbar .logo { font-size: 18px; font-weight: 700; margin-right: 32px; }
.topbar .logo i { margin-right: 8px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  padding: 0 16px; height: 60px;
  display: flex; align-items: center;
  color: #fff; opacity: .8; font-weight: 500;
  border-bottom: 3px solid transparent;
  transition: all .2s;
}
.topbar nav a:hover { opacity: 1; background: rgba(255,255,255,.1); }
.topbar nav a.active { opacity: 1; border-bottom-color: #fff; background: rgba(255,255,255,.08); }
.topbar .right { display: flex; align-items: center; gap: 16px; }
.topbar .right .switch {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
  border-radius: 20px; padding: 6px 12px; cursor: pointer; color: #fff;
  display: flex; align-items: center; gap: 6px;
}
.topbar .right .switch:hover { background: rgba(255,255,255,.25); }
.topbar .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ===== 容器 ===== */
.container { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* ===== 电脑版布局: 左侧导航 + 主内容 ===== */
.layout {
  display: flex;
  align-items: flex-start;
  max-width: 1760px;
  margin: 0 auto;
}
.sidebar {
  width: 252px; flex-shrink: 0;
  position: sticky; top: 76px;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  padding: 16px 10px 16px 18px;
  scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
.layout .container { flex: 1; min-width: 0; margin: 0; max-width: none; }

/* 侧栏 · 身份卡 */
.side-card {
  background: var(--panel); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 12px; margin-bottom: 14px;
}
.side-user { display: flex; align-items: center; gap: 10px; }
.side-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.side-user-name { font-weight: 600; font-size: 13.5px; }
.side-switch { font-size: 11.5px; color: var(--primary-3); cursor: pointer; }
.side-switch:hover { text-decoration: underline; }
.side-stats { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.side-stats .st {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  display: inline-flex; align-items: center; gap: 4px;
}
.side-stats .st.ok   { background: #dcfce7; color: #15803d; }
.side-stats .st.eye  { background: #fef9c3; color: #854d0e; }
.side-stats .st.lock { background: #fee2e2; color: #b91c1c; }
.side-hint {
  margin-top: 10px; font-size: 11px; color: var(--text-mute);
  background: var(--bg); border-radius: 8px; padding: 8px 10px; line-height: 1.5;
}

/* 侧栏 · 分组标题 */
.side-title {
  font-size: 11px; color: var(--text-mute); letter-spacing: 2px;
  padding: 10px 8px 6px; text-transform: uppercase;
}

/* 侧栏 · 一级菜单(模块) */
.side-group { margin-bottom: 2px; }
.side-l1 {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px; font-weight: 500; color: var(--text-soft);
  transition: background .15s;
}
.side-l1:hover { background: #eef2f9; }
.side-l1.active { background: var(--primary-soft); color: var(--primary); }
.side-l1 .fa:first-child { width: 18px; text-align: center; color: var(--primary-3); }
.side-l1.active .fa:first-child { color: var(--primary); }
.side-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-num {
  font-size: 10.5px; color: var(--text-mute);
  background: var(--bg); border-radius: 8px; padding: 1px 6px;
}
.side-chip { font-size: 10px; border-radius: 8px; padding: 1px 5px; }
.side-chip.chip-lock { background: #fee2e2; color: #b91c1c; }
.side-chip.chip-eye  { background: #fef9c3; color: #854d0e; }
.side-arrow { font-size: 12px !important; color: var(--text-mute); transition: transform .2s; width: auto !important; }
.side-group.open .side-arrow { transform: rotate(-90deg); }

/* 侧栏 · 二级菜单(功能) */
.side-l2-wrap {
  display: none; max-height: 260px; overflow-y: auto;
  padding: 2px 0 6px 26px;
  scrollbar-width: thin;
}
.side-l2-wrap::-webkit-scrollbar { width: 4px; }
.side-l2-wrap::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }
.side-group.open .side-l2-wrap { display: block; }
.side-l2 {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--text-soft);
  padding: 5px 8px; border-radius: 6px; cursor: pointer;
}
.side-l2:hover { background: #eef2f9; color: var(--primary); }
.s-mark { font-size: 10px; margin-left: 6px; }
.s-mark.s-lock { color: var(--err); }
.s-mark.s-eye { color: #d97706; }

/* 侧栏 · 快捷入口 */
.side-fixed a {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 8px;
  font-size: 13.5px; color: var(--text-soft); cursor: pointer;
}
.side-fixed a:hover { background: #eef2f9; color: var(--primary); }
.side-fixed .fa { width: 18px; text-align: center; color: var(--primary-3); }

/* 二级菜单点击后 · 功能方格闪烁定位 */
@keyframes featureFlash {
  0%, 100% { box-shadow: none; }
  25%, 75% { box-shadow: 0 0 0 3px var(--primary-3); }
  50% { box-shadow: 0 0 0 7px rgba(37,99,235,.25); }
}
.feature.flash { animation: featureFlash 1.1s ease 3; border-color: var(--primary-3); }

/* 滚动定位时给顶部吸顶导航留出空间 */
.module { scroll-margin-top: 80px; }

/* 中屏/窄屏隐藏侧栏 */
@media (max-width: 1023px) {
  .sidebar { display: none; }
  .layout { display: block; }
  .layout .container { max-width: 1400px; margin: 0 auto; }
}

.page-title {
  text-align: center;
  color: var(--primary);
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 24px;
}
.page-subtitle {
  text-align: center; color: var(--text-soft);
  margin: -16px 0 24px; font-size: 14px;
}

/* ===== 模块卡片 ===== */
.module {
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}
.module-header {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.module-header .icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-3));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.module-header h2 { font-size: 18px; margin: 0; }
.module-header .desc { color: var(--text-soft); font-size: 13px; margin-left: 16px; }
.module-canvas {
  margin-left: auto; white-space: nowrap; text-decoration: none;
  font-size: 13px; color: var(--primary); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px;
}
.module-canvas:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 功能图标 · 圆角方格 ===== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 14px;
}
.feature {
  position: relative;
  height: 96px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border: 1.5px solid var(--border);
  border-radius: var(--r-icon);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer;
  text-align: center;
  padding: 10px 8px;
  transition: all .2s;
  user-select: none;
}
.feature:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-3);
}
.feature .fa { font-size: 22px; color: var(--primary-3); margin-bottom: 6px; }
.feature .name {
  font-size: 12.5px; font-weight: 500;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feature .badge {
  position: absolute; top: 6px; right: 6px;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.feature .badge.lock { background: var(--err); }     /* 锁 */
.feature .badge.eye { background: var(--view); }    /* 眼睛 */
.feature .badge.src { font-size: 11px; font-weight: 800; width: 18px; height: 18px; }   /* 来源 */
.feature .badge.src.z { background: #1e40af; }      /* 智邦 Z */
.feature .badge.src.k { background: #ea580c; }      /* 快工单 K */

/* 自定义功能来源徽标(Z/K/新) */
.src-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  color: #fff; font-size: 11px; font-weight: 800;
  margin-right: 6px; vertical-align: -3px;
}
.src-chip.z { background: #1e40af; }
.src-chip.k { background: #ea580c; }
.src-chip.n { background: #059669; }

/* 锁定状态 */
.feature.locked { opacity: .55; }
.feature.locked:hover { transform: none; box-shadow: var(--shadow-sm); border-color: var(--border); }
.feature.locked .name { color: var(--text-mute); }

/* 只读状态 */
.feature.view-only .fa { color: var(--view); }
.feature.view-only:hover { border-color: var(--view); }

/* 自定义功能提示 */
.feature .tip {
  position: absolute; bottom: -28px; left: 50%; transform: translateX(-50%);
  background: #1f2937; color: #fff;
  padding: 4px 10px; border-radius: 6px;
  font-size: 11px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: all .2s; z-index: 10;
}
.feature:hover .tip { opacity: 1; bottom: -22px; }

/* ===== 权限管理面板 ===== */
.perm-panel {
  display: grid; gap: 16px;
  grid-template-columns: 240px 1fr;
}
.perm-panel .role-list {
  background: var(--panel); border-radius: var(--radius-lg);
  padding: 16px; box-shadow: var(--shadow-sm);
  max-height: 600px; overflow: auto;
}
.perm-panel .role-list h3 { margin: 0 0 12px; font-size: 14px; }
.perm-panel .role-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 8px;
  cursor: pointer; margin-bottom: 4px;
}
.perm-panel .role-item:hover { background: var(--bg); }
.perm-panel .role-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.perm-panel .perm-editor {
  background: var(--panel); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-sm);
  min-height: 600px;
}

.perm-tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.perm-tabs .tab {
  padding: 10px 16px; cursor: pointer;
  color: var(--text-soft); border-bottom: 2px solid transparent;
}
.perm-tabs .tab:hover { color: var(--primary); }
.perm-tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.perm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm-table th, .perm-table td {
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.perm-table th {
  background: var(--bg); font-weight: 600;
  color: var(--text-soft);
}
.perm-table tr:hover td { background: var(--bg); }
.perm-table .radio-group label { margin-right: 12px; cursor: pointer; }

/* ===== 自定义功能区 ===== */
.custom-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.custom-item {
  background: var(--panel); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--accent);
}
.custom-item .src-tag {
  display: inline-block; padding: 2px 8px;
  background: var(--primary-soft); color: var(--primary);
  border-radius: 10px; font-size: 11px;
  margin-bottom: 6px;
}
.custom-item .name { font-weight: 600; margin: 4px 0; }
.custom-item .desc { font-size: 12.5px; color: var(--text-soft); margin: 4px 0; }
.custom-item .belong { font-size: 11.5px; color: var(--text-mute); margin-top: 6px; }

/* ===== 登录页 ===== */
.login-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-3) 50%, var(--accent) 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 380px; background: #fff; border-radius: var(--radius-lg);
  padding: 40px; box-shadow: var(--shadow-lg);
}
.login-card h1 { text-align: center; color: var(--primary); margin: 0 0 28px; font-size: 22px; }
.login-card input {
  width: 100%; padding: 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  margin-bottom: 14px; outline: none;
}
.login-card input:focus { border-color: var(--primary-3); }
.login-card button {
  width: 100%; padding: 12px; border: none;
  background: var(--primary); color: #fff;
  border-radius: 8px; font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.login-card button:hover { background: var(--primary-2); }
.login-card .hint { color: var(--text-mute); font-size: 12px; text-align: center; margin-top: 16px; }

/* ===== 模态框 ===== */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-mask.show { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff; border-radius: var(--radius-lg);
  width: 560px; max-width: 92vw; max-height: 80vh;
  padding: 24px; overflow: auto;
  box-shadow: var(--shadow-lg);
}
.modal h3 { margin: 0 0 16px; color: var(--primary); }
.modal .close {
  float: right; background: none; border: none;
  font-size: 20px; cursor: pointer; color: var(--text-mute);
}

/* ===== 提示 ===== */
.toast {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.85); color: #fff;
  padding: 10px 20px; border-radius: 24px;
  font-size: 13px; z-index: 2000;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.toast.show { opacity: 1; }

/* ===== 移动端 ===== */
@media (max-width: 768px) {
  .container { padding: 12px; }
  .topbar { padding: 0 12px; height: 52px; }
  .topbar .logo { font-size: 16px; margin-right: 12px; }
  .topbar nav { display: none; }   /* 移动端用底部 tab */
  .feature-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
  .feature { height: 84px; }
  .perm-panel { grid-template-columns: 1fr; }
  .page-title { font-size: 20px; }
  /* 移动端底部 tab */
  .mobile-tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 99;
    background: #fff; border-top: 1px solid var(--border);
    display: flex; justify-content: space-around;
    padding: 6px 0 env(safe-area-inset-bottom, 8px);
  }
  .mobile-tabbar a {
    flex: 1; padding: 8px 0;
    text-align: center; color: var(--text-soft); font-size: 11px;
  }
  .mobile-tabbar a.active { color: var(--primary); }
  .mobile-tabbar a i { display: block; font-size: 18px; margin-bottom: 2px; }
}

/* ===== 手机版 · 9:16 真机外壳(桌面预览,真机自动全屏) ===== */
.phone-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 12px;
  background:
    radial-gradient(900px 480px at 15% 0%, rgba(37,99,235,.22), transparent 60%),
    radial-gradient(800px 420px at 90% 100%, rgba(6,182,212,.16), transparent 60%),
    linear-gradient(160deg, #0b1220 0%, #10203f 100%);
}
.phone-screen {
  position: relative;
  width: 390px; height: min(760px, 94vh);
  background: var(--bg);
  border-radius: 46px;
  border: 9px solid #0b0f1a;
  box-shadow: 0 0 0 1.5px #2a3a5f, 0 30px 80px rgba(0,0,0,.6);
  display: flex; flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
/* 灵动岛(桌面预览时显示) */
.phone-screen::before {
  content: ''; position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  width: 118px; height: 25px;
  background: #000; border-radius: 16px;
  z-index: 60;
}
.phone-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.phone-body::-webkit-scrollbar { display: none; }

@media (max-width: 768px) {
  .phone-shell { padding: 0; }
  .phone-screen {
    width: 100vw; height: 100vh; height: 100dvh;
    border: none; border-radius: 0; box-shadow: none;
  }
  .phone-screen::before { display: none; }
}

/* 工具类 */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.text-mute { color: var(--text-mute); }
.mt-12 { margin-top: 12px; }
.mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; }
.mb-24 { margin-bottom: 24px; }

/* ===== 夜间模式(深色主题) =====
 * 模式: auto(22:00-06:00 自动深色) / dark / light
 * 由 js/auth.js 的 Theme 模块驱动,切换 body.dark 类
 */
body.dark {
  --bg:           #0b1220;
  --panel:        #111a2c;
  --text:         #e2e8f0;
  --text-soft:    #cbd5e1;
  --text-mute:    #7d8aa0;
  --border:       #263349;
  --primary:      #0f172a;
  --primary-2:    #1e3a8a;
  --primary-3:    #3b82f6;
  --primary-soft: #1e293b;
  --accent:       #22d3ee;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.45);
  --shadow-md:    0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:    0 12px 32px rgba(0,0,0,.6);
}
body.dark .topbar { background: linear-gradient(90deg, #0f172a 0%, #1e3a8a 100%); }
body.dark .feature {
  background: linear-gradient(180deg, #131d31 0%, #0f1726 100%);
  border-color: #263349;
}
body.dark .feature:hover { border-color: #3b82f6; }
body.dark .side-l1:hover,
body.dark .side-l2:hover,
body.dark .side-fixed a:hover,
body.dark .perm-panel .role-item:hover { background: #1b2740; }
body.dark .side-l1.active,
body.dark .perm-panel .role-item.active { background: #1e3a8a; color: #dbeafe; }
body.dark .side-stats .st.ok   { background: #0f2f1d; color: #4ade80; }
body.dark .side-stats .st.eye  { background: #33280a; color: #fbbf24; }
body.dark .side-stats .st.lock { background: #3b0f14; color: #f87171; }
body.dark .side-chip.chip-lock { background: #3b0f14; color: #f87171; }
body.dark .side-chip.chip-eye  { background: #33280a; color: #fbbf24; }
body.dark .sidebar::-webkit-scrollbar-thumb,
body.dark .side-l2-wrap::-webkit-scrollbar-thumb { background: #334155; }
body.dark .page-title { color: #dbeafe; }
body.dark .perm-table th { background: #16233a; }
body.dark .custom-item .src-tag { background: #1e3a8a; color: #dbeafe; }
body.dark .feature .tip { background: #334155; color: #fff; }
body.dark .modal .close { color: #e2e8f0; }
body.dark .side-hint { background: #0d1526; }

/* ===== 数据概览 ===== */
.ov-note { padding:12px 16px; background:#eff6ff; color:#1e40af; border-radius:8px; font-size:13px; margin-bottom:18px; }
body.dark .ov-note { background:#1e293b; color:#93c5fd; }
.ov-group { background:#fff; border-radius:10px; padding:14px 16px 16px; margin-bottom:16px; box-shadow:0 1px 3px rgba(0,0,0,.05); }
body.dark .ov-group { background:#1e293b; }
.ov-group h3 { margin:0 0 12px; font-size:14px; padding-left:10px; }
.ov-cards { display:flex; gap:12px; flex-wrap:wrap; }
.ov-card { min-width:110px; flex:1; background:#f8fafc; border:1px solid #f1f5f9; border-radius:8px; padding:14px; text-align:center; }
body.dark .ov-card { background:#0f172a; border-color:#334155; }
.ov-num { font-size:24px; font-weight:800; color:#111827; }
body.dark .ov-num { color:#e2e8f0; }
.ov-label { font-size:12px; color:#64748b; margin-top:4px; }

/* ===== 侧栏 · 模块导航(一个主题一页) ===== */
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-mod {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px; cursor: pointer;
  font-size: 13.5px; font-weight: 500; color: var(--text-soft);
  transition: background .15s, color .15s; position: relative;
}
.side-mod:hover { background: #eef2f9; color: var(--text); }
.side-mod.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side-mod.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 3px; background: var(--primary);
}
.side-mod .fa:first-child { width: 18px; text-align: center; color: var(--primary-3); }
.side-mod.active .fa:first-child { color: var(--primary); }
.side-mod .side-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-mod .side-num { font-size: 11px; color: var(--text-mute); background: #f1f5f9; border-radius: 8px; padding: 0 7px; }
.side-mod.active .side-num { background: #fff; color: var(--primary); }
.side-mod .side-chip { font-size: 10px; border-radius: 8px; padding: 1px 5px; }
.side-mod .side-chip.chip-lock { background: #fee2e2; color: #b91c1c; }
.side-mod .side-chip.chip-eye  { background: #fef9c3; color: #854d0e; }
.side-mod .side-chip.chip-closed { background: #fee2e2; color: #b91c1c; }
.side-mod .side-chip.chip-modoff { background: #ede9fe; color: #6d28d9; font-weight: 600; }

/* ===== 模块页面(流程图作背景 + 按钮) ===== */
.module-page { padding: 0; }
.modpage-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.mph-left { display: flex; align-items: center; gap: 12px; }
.mph-icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-3));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 21px;
}
.mph-title { font-size: 19px; font-weight: 700; }
.mph-desc { font-size: 13px; color: var(--text-soft); margin-top: 2px; }
.mph-right { display: flex; gap: 8px; align-items: center; }
.btn-ghost {
  font-size: 13px; color: var(--primary); border: 1px solid var(--border);
  background: var(--panel); padding: 7px 13px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none;
}
.btn-ghost:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.modpage-canvas {
  position: relative; width: 100%; max-width: 1280px; margin: 0 auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); min-height: 360px; overflow: hidden;
}
.modpage-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; pointer-events: none; border-radius: var(--radius-lg);
}
.modchip {
  position: absolute; transform: translate(-50%, -50%);
  min-width: 78px; max-width: 134px; min-height: 46px; padding: 9px 10px;
  background: transparent; color: #dc2626; border: 1px solid rgba(220,38,38,.35); border-radius: 10px;
  font-size: 12px; line-height: 1.25; text-align: center; text-decoration: none;
  text-shadow: 0 1px 3px rgba(255,255,255,.78);
  box-shadow: none; user-select: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: transform .12s, color .12s, border-color .12s, background .12s;
}
.modchip:hover { background: rgba(220,38,38,.10); color: #b91c1c; border-color: rgba(220,38,38,.6); transform: translate(-50%, -50%) scale(1.06); z-index: 10; }
.modchip .ic { display: block; font-size: 14px; opacity: .92; margin-bottom: 3px; }
.modchip .nm { font-weight: 600; word-break: break-all; }
.modchip .chip-badge {
  position: absolute; top: -8px; right: -8px; font-size: 11px;
  background: #fff; border-radius: 50%; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.modchip .chip-badge.lock { color: #b91c1c; }
.modchip .chip-badge.eye  { color: #854d0e; }
.modchip .chip-badge.closed { color: #fff; background: #dc2626; }
.modchip.is-locked { background: transparent; color: #9f1239; border-color: rgba(159,18,57,.4); cursor: not-allowed; }
.modchip.is-locked:hover { background: rgba(159,18,57,.12); transform: translate(-50%, -50%); }
.modchip.is-closed { color: #dc2626; border: 1px dashed #fca5a5; text-decoration: line-through; opacity: .9; }
.modchip.is-closed .ic { opacity: .55; }
.modchip.is-closed:hover { background: rgba(220,38,38,.10); transform: translate(-50%, -50%) scale(1.05); }
.modpage-empty { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); color:#94a3b8; font-size:14px; }

/* 暗色模式 */
body.dark .side-mod:hover { background: #1b2740; color: #e2e8f0; }
body.dark .side-mod .side-num { background: #334155; color: #cbd5e1; }
body.dark .side-mod .side-chip.chip-lock { background: #3b0f14; color: #f87171; }
body.dark .side-mod .side-chip.chip-eye  { background: #33280a; color: #fbbf24; }
body.dark .side-mod .side-chip.chip-closed { background: #3b0f14; color: #f87171; }
body.dark .side-mod .side-chip.chip-modoff { background: #2e1065; color: #c4b5fd; }
body.dark .modchip.is-closed { color: #f87171; border-color: #7f1d1d; }
body.dark .modpage-canvas { background: #0f172a; border-color: #263349; }
body.dark .modchip { background: transparent; color: #f87171; border-color: rgba(248,113,113,.4); text-shadow: 0 1px 3px rgba(255,255,255,.85); }
body.dark .modchip:hover { background: rgba(248,113,113,.14); color: #fca5a5; }
body.dark .modchip.is-locked { background: transparent; color: #fca5a5; border-color: rgba(248,113,113,.3); }
body.dark .btn-ghost { background: #16233a; color: #93c5fd; border-color: #263349; }
body.dark .btn-ghost:hover { background: var(--primary); color: #fff; }
