/* ========== 企业内部管理系统 样式（PC 侧边栏 + 手机抽屉自适应） ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --brand: #2557e6;
  --brand-dark: #1d44b8;
  --bg: #f2f4f8;
  --side-bg: #141a2b;
  --side-text: #aab3c5;
  --side-active: #2f6bff;
  --card: #ffffff;
  --text: #1f2733;
  --text-2: #6b7585;
  --border: #e6e9f0;
  --radius: 10px;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
  display: flex; flex-direction: column;
}
.hidden { display: none !important; }
a { text-decoration: none; color: inherit; cursor: pointer; }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  display: inline-block; border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 9px 16px; border-radius: 8px; font-size: 14px; cursor: pointer; transition: .15s;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.form-input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; transition: border-color .15s;
}
.form-input:focus { border-color: var(--brand); }
.form-gap { margin-top: 12px; }

/* ---------- 登录页 ---------- */
.login-mask {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(135deg, #1d2b53 0%, #2557e6 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  width: 100%; max-width: 360px; background: #fff; border-radius: 16px;
  padding: 36px 30px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo { font-size: 44px; text-align: center; }
.login-title { font-size: 20px; font-weight: 700; text-align: center; margin-top: 10px; }
.login-sub { font-size: 13px; color: var(--text-2); text-align: center; margin: 6px 0 24px; }
.login-btn { margin-top: 18px; padding: 12px; font-size: 15px; }
.login-foot { text-align: center; color: #9aa3b2; font-size: 12px; margin-top: 16px; }

/* ---------- 主框架布局 ---------- */
.app { flex: 1; display: flex; min-height: 100vh; }

/* 手机顶栏（PC 隐藏） */
.topbar {
  display: none; position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 40;
  background: var(--side-bg); color: #fff; align-items: center; padding: 0 14px;
}
.menu-toggle { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 4px 8px; }
.topbar-title { flex: 1; font-size: 16px; font-weight: 600; padding-left: 6px; }
.topbar-user { font-size: 13px; color: var(--side-text); }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 230px; flex-shrink: 0; background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.logo-mark { font-size: 26px; }
.logo-text b { display: block; color: #fff; font-size: 16px; }
.logo-text span { font-size: 12px; color: var(--side-text); }
.nav { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 10px 12px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  font-size: 14px; margin-bottom: 2px; white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--side-active); color: #fff; }
.nav-icon { width: 20px; text-align: center; flex-shrink: 0; }
.nav-sub { padding-left: 34px; font-size: 13px; }
.nav-group-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-size: 13px;
  color: #8791a5; cursor: pointer; user-select: none;
}
.nav-caret { margin-left: auto; font-size: 10px; transition: transform .2s; }
.nav-group:not(.open) .nav-caret { transform: rotate(-90deg); }
.nav-group:not(.open) .nav-group-body { display: none; }

.sidebar-foot { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.me-box { padding: 2px 4px 10px; }
.me-name { color: #fff; font-size: 14px; font-weight: 600; }
.me-meta { font-size: 12px; color: var(--side-text); margin-top: 2px; }
.btn-logout {
  width: 100%; background: rgba(255,255,255,.06); border: none; color: var(--side-text);
  padding: 8px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.btn-logout:hover { background: rgba(255,80,80,.18); color: #ff8a8a; }

/* ---------- 内容区 ---------- */
.content { flex: 1; min-width: 0; padding: 22px 26px 40px; }
.page-head { margin-bottom: 18px; }
.page-head h2 { font-size: 19px; font-weight: 700; }

/* 首页欢迎卡 */
.welcome-card { background: var(--card); border-radius: var(--radius); padding: 26px; box-shadow: 0 1px 3px rgba(20,30,50,.05); }
.welcome-title { font-size: 20px; font-weight: 700; }
.welcome-sub { color: var(--text-2); margin-top: 8px; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 22px; }
.stat-card {
  background: linear-gradient(135deg, #f5f8ff, #eef3ff); border: 1px solid #e3ebff;
  border-radius: var(--radius); padding: 18px;
}
.stat-num { font-size: 18px; font-weight: 700; color: var(--brand); }
.stat-label { font-size: 13px; color: var(--text-2); margin-top: 6px; }

/* 模块占位 */
.placeholder {
  background: var(--card); border-radius: var(--radius); padding: 70px 30px; text-align: center;
  box-shadow: 0 1px 3px rgba(20,30,50,.05);
}
.ph-icon { font-size: 52px; }
.ph-title { font-size: 19px; font-weight: 700; margin-top: 14px; }
.ph-sub { color: var(--text-2); margin-top: 10px; font-size: 14px; }
.ph-tip { margin-top: 18px; display: inline-block; background: #f2f5fb; color: #5a6add; font-size: 12px; padding: 6px 14px; border-radius: 20px; }

/* ---------- 弹窗 / toast ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,20,35,.5); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; padding: 26px 24px; width: 100%; max-width: 360px;
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 18px; text-align: center; }
.modal .btn-primary { margin-top: 16px; }
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 300;
  background: rgba(20,24,35,.92); color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 14px;
  max-width: 80vw;
}

/* ---------- 手机适配 ---------- */
.side-mask { display: none; }
@media (max-width: 768px) {
  .topbar { display: flex; }
  .app { padding-top: 52px; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease; height: 100vh;
  }
  .sidebar.open { transform: translateX(0); }
  .side-mask.show {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50;
  }
  .content { padding: 16px 14px 30px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .placeholder { padding: 50px 18px; }
}

/* ==================== 阶段1：业务通用 ==================== */
.btn-danger { background: #e84a3f; border-color: #e84a3f; color: #fff; }
.btn-danger:hover { background: #c93a30; border-color: #c93a30; color: #fff; }
.btn-danger-plain { color: #d6453a; border-color: #f0c6c2; }
.btn-danger-plain:hover { background: #fdf0ef; border-color: #e84a3f; color: #d63428; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 6px; }

/* 工具栏 */
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.toolbar-title h2 { font-size: 19px; font-weight: 700; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-input { width: 210px; }
.dept-select { width: 130px; }

/* 标签 */
.tag {
  display: inline-block; font-size: 11.5px; line-height: 1; padding: 3px 8px;
  border-radius: 10px; font-weight: 500; vertical-align: middle;
}
.tag-boss { background: #fff1e8; color: #d9680f; }
.tag-manager { background: #e8f0ff; color: #2557e6; }
.tag-finance { background: #e8f8ef; color: #1a9e57; }
.tag-staff { background: #eef0f4; color: #697386; }
.tag-warn { background: #fff5e0; color: #b8800c; }
.tag-mini { font-size: 11px; padding: 2px 7px; background: #eef0f4; color: #697386; }

/* 首字头像 */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #4a78ff, #2557e6); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600;
}

/* 状态点 */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; vertical-align: middle; }
.dot-on { background: #22b366; }
.dot-off { background: #c3c9d4; }

/* 空/加载提示 */
.empty-mini, .loading-mini {
  background: var(--card); border-radius: var(--radius); padding: 40px 20px;
  text-align: center; color: var(--text-2); font-size: 13.5px;
  box-shadow: 0 1px 3px rgba(20,30,50,.05);
}

/* 首页快捷入口 */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 20px; }
.quick {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: #f7f9ff; border: 1px solid #e6ecfb; border-radius: 10px; padding: 18px 8px;
  font-size: 13.5px; color: var(--text); transition: .15s;
}
.quick span { font-size: 26px; }
.quick:hover { border-color: var(--brand); background: #eef3ff; transform: translateY(-2px); }

/* 部门卡片 */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.dept-card {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: 0 1px 3px rgba(20,30,50,.05); display: flex; flex-direction: column; gap: 8px;
}
.dept-card-name { font-size: 16px; font-weight: 700; }
.dept-card-meta { font-size: 13px; color: var(--text-2); }
.dept-card-count { font-size: 13px; color: var(--brand); font-weight: 600; }
.card-actions { display: flex; gap: 8px; margin-top: 6px; }

/* 员工行 */
.emp-row {
  background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 14px; box-shadow: 0 1px 3px rgba(20,30,50,.05);
}
.emp-main { flex: 1; min-width: 0; }
.emp-line1 { font-size: 15px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.emp-line2 { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.emp-line3 { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.emp-ops { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

/* 弹窗增强 */
.modal-lg { max-width: 640px; max-height: 88vh; overflow-y: auto; width: 100%; }
.confirm-text { font-size: 14.5px; line-height: 1.7; color: var(--text); margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.field-label { display: block; font-size: 13px; color: var(--text-2); margin: 12px 0 5px; }
.form-tip {
  font-size: 12.5px; color: #8a6d2f; background: #fdf8ec; border-radius: 8px;
  padding: 8px 12px; margin-top: 14px; line-height: 1.6;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .grid-full { grid-column: 1 / -1; }

/* 档案详情 */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; font-size: 13.5px; }
.detail-grid .grid-full { grid-column: 1 / -1; }
.detail-grid label { display: block; color: var(--text-2); font-size: 12px; margin-bottom: 2px; }

/* 上传区 */
.upload-zone {
  margin-top: 16px; padding: 14px; background: #f7f9fd; border: 1px dashed #c7d3ea;
  border-radius: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.kind-select { width: 90px !important; }
.file-input { font-size: 12.5px; flex: 1; min-width: 140px; }
.up-progress { font-size: 12.5px; color: var(--brand); min-width: 40px; }
.upload-zone .form-tip { width: 100%; margin-top: 4px; }

/* 附件列表 */
.file-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.file-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: #f7f9fd; border-radius: 8px; font-size: 13px;
}
.file-name { color: var(--brand); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--text-2); font-size: 12px; }

/* 通讯录 */
.ct-group { margin-bottom: 16px; }
.ct-group-head {
  font-size: 13px; font-weight: 600; color: var(--text-2); padding: 4px 4px 8px;
}
.ct-group-head span { font-weight: 400; color: #9aa3b2; }
.ct-item {
  background: var(--card); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 1px 3px rgba(20,30,50,.05);
}
.ct-main { flex: 1; min-width: 0; }
.ct-name { font-size: 15px; display: flex; align-items: center; gap: 7px; }
.ct-sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.ct-call { font-size: 13px; color: var(--brand); white-space: nowrap; }
.ct-no-phone { font-size: 12.5px; color: #b0b7c3; white-space: nowrap; }

/* 设置页 */
.set-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.set-card {
  background: var(--card); border-radius: var(--radius); padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(20,30,50,.05); margin-bottom: 16px;
}
.set-card h3 { font-size: 16px; margin-bottom: 8px; }
.role-line { margin: 14px 0; font-size: 13.5px; }
.role-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.role-table th, .role-table td { border: 1px solid var(--border); padding: 9px 10px; text-align: left; }
.role-table th { background: #f7f9fd; width: 70px; }
.sys-line { font-size: 13.5px; color: var(--text-2); line-height: 2; }

/* ---------- 阶段1 手机适配 ---------- */
@media (max-width: 768px) {
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-actions { width: 100%; }
  .search-input { flex: 1; width: auto; min-width: 0; }
  .dept-select { width: auto; }
  .toolbar-actions .btn-primary { margin-left: auto; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .emp-row { flex-wrap: wrap; }
  .emp-main { width: calc(100% - 54px); }
  .emp-ops { width: 100%; justify-content: flex-start; padding-left: 54px; }
  .form-grid, .detail-grid, .set-cols { grid-template-columns: 1fr; }
  .ct-call { font-size: 12px; }
  .modal-lg { max-height: 92vh; }
}
