/* 人事管理演示系统 — 统一视觉系统
   配色：深蓝主色 + 中性灰底；状态用琥珀/翠绿/砖红三色区分 */

:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --ink: #17202e;
  --ink-soft: #3d4859;
  --muted: #77839a;
  --line: #e4e8ee;
  --line-soft: #eef1f5;
  --primary: #274a80;
  --primary-dark: #1c3559;
  --primary-soft: #eef2f9;
  --sidebar: #16233a;
  --sidebar-soft: #23324d;
  --amber: #a16207;
  --amber-bg: #fdf3e0;
  --green: #15704a;
  --green-bg: #e7f6ee;
  --red: #b3261e;
  --red-bg: #fdecea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(23, 32, 46, .04), 0 8px 24px rgba(23, 32, 46, .06);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 骨架 ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: var(--sidebar);
  color: #cfd8e6;
  display: flex;
  flex-direction: column;
  padding: 24px 0;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 20px 26px; }
.brand-mark {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(140deg, #3d6bb0, #274a80);
  color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .5px;
}
.brand-text { font-size: 15px; font-weight: 600; color: #fff; letter-spacing: .3px; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.nav-link {
  padding: 9px 12px;
  border-radius: 8px;
  color: #b9c5d8;
  font-size: 14px;
  transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: var(--sidebar-soft); color: #fff; text-decoration: none; }
.nav-link.is-active { background: var(--sidebar-soft); color: #fff; font-weight: 600; }

.sidebar-foot {
  margin-top: auto;
  padding: 18px 20px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.who { display: flex; flex-direction: column; margin-bottom: 10px; }
.who-name { color: #fff; font-size: 13px; font-weight: 600; }
.who-role { color: #7f8ea6; font-size: 12px; }

.main { flex: 1 1 auto; padding: 30px 36px 48px; max-width: 1320px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.page-title { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: .2px; }
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- 卡片与面板 ---------- */
.stat-row {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px; margin-bottom: 22px;
}
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.stat-accent { border-color: #c9d6ec; background: linear-gradient(180deg, #f6f9fd, #fff); }
.stat-label { display: block; color: var(--muted); font-size: 12px; letter-spacing: .6px; }
.stat-value { display: block; font-size: 30px; font-weight: 650; line-height: 1.25; margin-top: 4px; }
.stat-note { display: block; color: var(--ink-soft); font-size: 12px; margin-top: 4px; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px; margin-bottom: 22px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.panel-title { margin: 0; font-size: 15px; font-weight: 620; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.grid-2 > .panel { margin-bottom: 22px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 680px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  letter-spacing: .5px; padding: 8px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 11px 12px; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle; white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfd; }
.cell-strong { font-weight: 600; color: var(--ink); }
.cell-muted { color: var(--muted); }
.cell-mono { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; color: var(--ink-soft); }
.cell-right { text-align: right; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 26px 0; }

/* ---------- 状态标签 ---------- */
.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill-1 { color: var(--green); background: var(--green-bg); }
.pill-2 { color: var(--red); background: var(--red-bg); }
.pill-3 { color: var(--amber); background: var(--amber-bg); }

/* ---------- 描述列表 ---------- */
.deflist { display: grid; grid-template-columns: 104px 1fr; gap: 9px 16px; margin: 0; }
.deflist dt { color: var(--muted); font-size: 13px; }
.deflist dd { margin: 0; color: var(--ink); word-break: break-all; }

/* ---------- 交互元件 ---------- */
.btn-primary, .btn-danger, .btn-ghost {
  display: inline-block; padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-danger { background: #fff; color: var(--red); border-color: #e7c3bf; }
.btn-danger:hover { background: var(--red-bg); text-decoration: none; }
.btn-ghost { background: #fff; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { border-color: #c3ccd9; text-decoration: none; }
.btn-block { width: 100%; padding: 10px 16px; }

.search { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search input {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; min-width: 280px; color: var(--ink); background: #fff;
  font-family: inherit;
}
.search input:focus { outline: 2px solid #c9d9f0; border-color: var(--primary); }

.tabs { display: flex; gap: 6px; }
.tab {
  padding: 6px 14px; border-radius: 999px; font-size: 13px;
  color: var(--ink-soft); border: 1px solid transparent;
}
.tab:hover { background: var(--primary-soft); text-decoration: none; }
.tab.is-active { background: var(--primary); color: #fff; font-weight: 600; }

.link { color: var(--primary); font-size: 13px; }
.hint { color: var(--ink-soft); font-size: 13px; background: var(--primary-soft);
  border-radius: 8px; padding: 12px 14px; }
.review-actions { display: flex; gap: 10px; margin-top: 14px; }

.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-top: 14px; border-top: 1px solid var(--line-soft);
}
.pager-info { color: var(--muted); font-size: 12.5px; }

.flash { margin-bottom: 18px; }
.flash-item {
  margin: 0 0 8px; padding: 10px 14px; border-radius: 8px; font-size: 13px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
}
.flash-item.success { background: var(--green-bg); border-color: #c5e6d5; color: var(--green); }
.flash-item.error { background: var(--red-bg); border-color: #f0cdc9; color: var(--red); }

.doc-preview {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px;
  background: #fafbfd; text-align: center;
}
.doc-preview img { max-width: 100%; border-radius: 4px; }

/* ---------- 登录页 ---------- */
.login-body {
  display: grid; place-items: center; min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -10%, #e8eef8 0%, var(--bg) 60%);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  padding: 32px 30px 26px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand h1 { margin: 0; font-size: 18px; font-weight: 650; }
.login-brand p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.field input {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; color: var(--ink);
}
.field input:focus { outline: 2px solid #c9d9f0; border-color: var(--primary); }
.login-foot { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 12px; }
.error-card { max-width: 420px; text-align: left; }
.error-card .btn-block { margin-top: 20px; }

@media (max-width: 1080px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

/* 窄屏：侧边栏转为顶部导航，避免挤压内容区 */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; flex-direction: row; align-items: center;
    gap: 14px; padding: 12px 16px;
  }
  .brand { padding: 0; flex: none; }
  .nav { flex-direction: row; padding: 0; overflow-x: auto; }
  .nav-link { white-space: nowrap; }
  .sidebar-foot {
    margin: 0 0 0 auto; padding: 0; border-top: none;
    flex-direction: row; align-items: center; gap: 10px; flex: none;
  }
  .who { margin-bottom: 0; }
  .main { padding: 20px 16px 40px; }
  .page-head { flex-wrap: wrap; }
}

@media (max-width: 620px) {
  .stat-row { grid-template-columns: minmax(0, 1fr); }
  .deflist { grid-template-columns: 84px 1fr; }
  .who { display: none; }
  .search input { min-width: 180px; }
}
