/* ============ 工作台高级布局 ============ */

:root {
  --side-w: 248px;
  --side-bg: #0f172a;
  --side-bg2: #111c34;
  --head-h: 76px;
}

body { background: #f1f4f9; }

/* ---------- 登录页 ---------- */
.login-card {
  max-width: 420px;
  padding: 36px 34px 26px;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .12);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.login-brand h1 { font-size: 24px; }
.login-brand .sub { margin: 0; }
.brand-logo {
  flex: 0 0 auto;
  width: 52px; height: 52px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
}

/* 角色选择 */
.role-grid { display: grid; gap: 10px; margin-bottom: 18px; }
.role-card {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: .16s;
}
.role-card:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.role-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.role-ico {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.role-card b { font-size: 14px; }
.role-card small { margin-left: auto; color: var(--muted); font-size: 11px; }
.back-roles { display: block; margin: 12px auto 0; background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; }
.back-roles:hover { color: var(--accent); }
.brand-mark {
  flex: 0 0 auto;
  width: 48px; height: 48px;
  border-radius: 13px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .35);
}
.login-label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.login-card input { margin-bottom: 16px; padding: 12px 14px; border-radius: 10px; }
.login-card .btn { padding: 12px; letter-spacing: .1em; }
.login-foot { margin-top: 22px; text-align: center; font-size: 12px; color: #94a3b8; }

/* ---------- 应用骨架 ---------- */
.app-shell { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--side-w);
  background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg2) 100%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  padding: 0 14px 18px;
  z-index: 20;
  box-shadow: 2px 0 20px rgba(15, 23, 42, .08);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 22px 12px 20px; }
.sidebar-brand .brand-mark { width: 42px; height: 42px; font-size: 21px; }
.sidebar-brand .brand-logo { width: 42px; height: 42px; background: #fff; border-radius: 10px; }
.brand-text .brand-name { color: #fff; font-size: 17px; font-weight: 700; letter-spacing: .02em; }
.brand-text .brand-desc { font-size: 11px; color: #64748b; margin-top: 1px; }
.sidebar-label { font-size: 11px; color: #475569; text-transform: uppercase; letter-spacing: .12em; margin: 12px 12px 8px; font-weight: 700; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }

.side-nav .nav-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  color: #aab7cc;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  transition: background .16s, color .16s;
}
.side-nav .nav-tab:hover { background: rgba(148, 163, 184, .1); color: #fff; }
.side-nav .nav-tab.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .35);
}
.nav-icon {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  opacity: .9;
}
.nav-arrow { margin-left: auto; font-size: 17px; opacity: .5; }

.sidebar-foot { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid rgba(148, 163, 184, .15); }
.side-status { font-size: 12px; color: #94a3b8; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.side-status i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .15); }
.logout-btn {
  width: 100%;
  padding: 9px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, .25);
  background: transparent;
  color: #cbd5e1;
  font-size: 13px;
  cursor: pointer;
  transition: .16s;
}
.logout-btn:hover { background: rgba(239, 68, 68, .15); border-color: rgba(239, 68, 68, .4); color: #fca5a5; }

/* ---------- 主区 ---------- */
.main-area { flex: 1; margin-left: var(--side-w); min-width: 0; }
.main-head {
  height: var(--head-h);
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 34px;
  position: sticky; top: 0; z-index: 10;
}
.head-title { font-size: 20px; }
.head-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.head-date { font-size: 13px; color: var(--muted); }

/* ---------- 统计卡片 ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 26px 34px 6px;
}
.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 18px 20px;
  display: flex; align-items: center; gap: 15px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, .05);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute; right: -18px; top: -18px;
  width: 70px; height: 70px; border-radius: 50%;
  opacity: .08;
}
.stat-blue::after { background: #3b82f6; }
.stat-violet::after { background: #8b5cf6; }
.stat-green::after { background: #10b981; }
.stat-amber::after { background: #f59e0b; }
.stat-icon {
  flex: 0 0 auto;
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; color: #fff;
}
.stat-blue .stat-icon { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.stat-violet .stat-icon { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.stat-green .stat-icon { background: linear-gradient(135deg, #34d399, #059669); }
.stat-amber .stat-icon { background: linear-gradient(135deg, #fbbf24, #d97706); }
.stat-num { font-size: 27px; font-weight: 750; line-height: 1; color: var(--text); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- 内容区 ---------- */
.main-content { padding: 20px 34px 48px; }
.section-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; margin-bottom: 18px; }
/* 通讯录：左组织架构（窄）+ 右员工列表（宽） */
.contacts-layout { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.contacts-layout .tree-panel { position: sticky; top: 96px; }
.contacts-layout .list-panel { min-width: 0; }
@media (max-width: 980px) { .contacts-layout { grid-template-columns: 1fr; } .contacts-layout .tree-panel { position: static; } }
.panel { padding: 22px 24px; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.panel-head h2 { font-size: 16px; }
.panel-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.panel-icon {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700;
}
.panel-icon.blue { background: var(--accent-soft); color: var(--accent); }
.panel-icon.violet { background: #f5f3ff; color: #7c3aed; }
.panel-icon.green { background: var(--green-soft); color: var(--green); }
.panel-help { background: linear-gradient(180deg, #fbfdff, #f8fafc); }
.help-list { margin: 0; padding-left: 2px; list-style: none; }
.help-list li { position: relative; padding: 7px 0 7px 20px; font-size: 13px; color: #475569; line-height: 1.6; }
.help-list li::before {
  content: ''; position: absolute; left: 2px; top: 15px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.help-list b { color: var(--text); }
.help-tip {
  margin-top: 14px; padding: 11px 13px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; line-height: 1.6;
}
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .section-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { width: 100%; height: auto; bottom: auto; position: relative; padding: 12px; }
  .sidebar-brand, .sidebar-label, .sidebar-foot { display: none; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-nav .nav-tab { width: auto; flex: 1 1 auto; }
  .main-area { margin-left: 0; }
  .main-head, .stats-row, .main-content { padding-left: 18px; padding-right: 18px; }
  .head-date { display: none; }
}


/* ---------- 手机端深度适配 ---------- */
@media (max-width: 640px) {
  .side-nav { gap: 4px; }
  .side-nav .nav-tab { flex: 1 1 45%; padding: 8px 6px; font-size: 12px; }
  .side-nav .nav-icon { display: none; }
  .main-head, .stats-row, .main-content { padding-left: 12px !important; padding-right: 12px !important; }
  .stats-row { gap: 10px; }
  .stat-card { padding: 14px; }
  .section-grid, .contacts-layout, .mail-layout { grid-template-columns: 1fr !important; }
  .panel { padding: 16px 14px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .task-head { flex-direction: column; }
  .task-card .actions { width: 100%; }
  .task-card .actions .btn { flex: 1 1 45%; }
  .modal-card { width: calc(100vw - 24px) !important; padding: 18px 14px !important; }
  .modal-card.wide { width: calc(100vw - 20px) !important; }
  .contact-table { min-width: 900px; }
  .people-table { min-width: 640px; }
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .batch-bar { font-size: 12px; }
  .batch-bar .btn { flex: 1 1 auto; }
  .mail-folder-title { display: none; }
  .mail-folders { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; }
  .mail-folder { width: auto; flex: 1 1 auto; font-size: 12px; padding: 8px; }
  .mail-folders .btn-block { width: 100% !important; }
  .mail-item { gap: 8px; }
  .mail-item-actions { display: none; }
  .emp-mail-content, .mail-body-content { font-size: 13px; }
}
