/* =============================================================
   后台布局
   ============================================================= */

.admin-body { background: var(--c-bg); }

.admin-shell { display: flex; min-height: 100vh; }

/* ---------------- 侧栏 ---------------- */
.sidebar {
  width: 232px; flex: 0 0 232px;
  background: var(--c-dark);
  color: #cbd5e1;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-logo {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--c-primary); color: #fff;
  border-radius: 10px; font-size: 19px; font-weight: 700;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { color: #fff; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text em { font-style: normal; font-size: 11.5px; color: #7c8ba1; }

.sidebar-nav { padding: 12px 10px 30px; }
.nav-group { margin-bottom: 6px; }
.nav-group-title {
  padding: 10px 10px 5px;
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  color: #64748b; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px; margin-bottom: 1px;
  font-size: 13.5px; color: #cbd5e1;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background .13s, color .13s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--c-primary); color: #fff; font-weight: 500; }
.nav-icon { width: 18px; text-align: center; font-size: 14px; flex: 0 0 18px; }

/* ---------------- 主区 ---------------- */
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px; height: 58px;
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; z-index: 20;
}
.sidebar-toggle {
  display: none;
  background: none; border: 0; font-size: 20px; cursor: pointer;
  color: var(--c-text-2); padding: 4px 6px;
}
.topbar-title { flex: 1; margin: 0; font-size: 16.5px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; flex-direction: column; line-height: 1.25; text-align: right; }
.user-name { font-size: 13.5px; font-weight: 500; }
.user-role { font-size: 11.5px; color: var(--c-text-3); }

.admin-content { flex: 1; padding: 20px 22px 34px; min-width: 0; }
.admin-footer {
  padding: 14px 22px; font-size: 12px; color: var(--c-text-3);
  border-top: 1px solid var(--c-border); background: var(--c-white);
}

/* ---------------- 页头 ---------------- */
.page-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.page-head h2 { margin: 0; font-size: 18px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------- 筛选条 ---------------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 12px 14px; margin-bottom: 14px;
  background: var(--c-white); border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.filter-bar .input { width: auto; min-width: 150px; }
.filter-bar input[type="text"].input { min-width: 210px; flex: 1 1 210px; max-width: 320px; }
.filter-bar .btn { flex: 0 0 auto; }
.filter-bar label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--c-text-2); }

/* ---------------- 统计卡片 ---------------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.stat-card {
  padding: 16px 18px; background: var(--c-white);
  border: 1px solid var(--c-border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-label { font-size: 12.5px; color: var(--c-text-2); margin-bottom: 6px; }
.stat-card .stat-value { font-size: 25px; font-weight: 700; color: var(--c-dark); line-height: 1.15; }
.stat-card .stat-value small { font-size: 13px; font-weight: 500; color: var(--c-text-3); margin-left: 3px; }
.stat-card .stat-foot { margin-top: 6px; font-size: 12px; color: var(--c-text-3); }
.stat-card.accent { border-color: var(--c-primary); background: linear-gradient(135deg, #f0fdf4, #fff); }
.stat-card.accent .stat-value { color: var(--c-primary-dark); }
.stat-card.danger .stat-value { color: var(--c-danger); }

/* ---------------- 面板 ---------------- */
.panel {
  background: var(--c-white); border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  margin-bottom: 18px; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--c-border); background: #f8fafc;
}
.panel-head h3 { margin: 0; font-size: 14.5px; }
.panel-body { padding: 16px; }
.panel-body.flush { padding: 0; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1000px) { .two-col, .three-col { grid-template-columns: 1fr; } }

/* ---------------- 表单卡片 ---------------- */
.form-card {
  background: var(--c-white); border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 22px;
}
.form-foot {
  display: flex; gap: 10px; align-items: center;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--c-border);
}
.form-section-title {
  grid-column: span 12;
  margin: 6px 0 -4px; padding-bottom: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--c-dark-2);
  border-bottom: 1px solid var(--c-border);
}

/* ---------------- 详情表 ---------------- */
.detail-card {
  background: var(--c-white); border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
}
.detail-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.detail-table th, .detail-table td {
  padding: 11px 16px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--c-border);
}
.detail-table th {
  width: 160px; background: #f8fafc; font-weight: 500; color: var(--c-text-2);
  white-space: nowrap;
}
.detail-table tr:last-child th, .detail-table tr:last-child td { border-bottom: 0; }

/* ---------------- 登录页 ---------------- */
.blank-body {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(140deg, #0f172a 0%, #14532d 100%);
  padding: 30px 16px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--c-white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 34px 30px 28px;
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand .brand-logo { width: 54px; height: 54px; flex: none; font-size: 26px; margin: 0 auto 12px; border-radius: 14px; }
.login-brand h1 { font-size: 19px; margin: 0 0 4px; }
.login-brand p { font-size: 12.5px; color: var(--c-text-3); margin: 0; }
.login-card .form-row { margin-bottom: 15px; }
.login-foot { margin-top: 18px; text-align: center; font-size: 12.5px; color: var(--c-text-3); }
.login-foot a { color: var(--c-text-2); }

/* ---------------- 标签页 ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--c-border); margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  padding: 9px 16px; font-size: 13.5px; color: var(--c-text-2);
  border-bottom: 2px solid transparent; text-decoration: none;
}
.tab:hover { color: var(--c-text); text-decoration: none; }
.tab.active { color: var(--c-primary-dark); border-bottom-color: var(--c-primary); font-weight: 500; }

/* ---------------- 考勤快捷选择（纯 CSS，无 :has 依赖） ---------------- */
.att-options { display: flex; gap: 4px; flex-wrap: wrap; }
.att-pill { cursor: pointer; margin: 0; }
.att-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.att-pill > span {
  display: inline-block; padding: 3px 11px; font-size: 12.5px; line-height: 1.7;
  border: 1px solid var(--c-border); border-radius: 999px; background: #fff;
  color: var(--c-text-2); transition: all .12s; white-space: nowrap;
}
.att-pill:hover > span { border-color: #cbd5e1; }
.att-pill input:focus-visible + span { box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.att-pill.p-present input:checked + span { background: var(--c-primary); border-color: var(--c-primary); color: #fff; font-weight: 500; }
.att-pill.p-late    input:checked + span { background: var(--c-warn);    border-color: var(--c-warn);    color: #fff; font-weight: 500; }
.att-pill.p-absent  input:checked + span { background: var(--c-danger);  border-color: var(--c-danger);  color: #fff; font-weight: 500; }
.att-pill.p-leave   input:checked + span { background: var(--c-info);    border-color: var(--c-info);    color: #fff; font-weight: 500; }

/* ---------------- 进度条 ---------------- */
.bar { height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--c-primary); border-radius: 999px; }
.bar.warn > span { background: var(--c-warn); }
.bar.danger > span { background: var(--c-danger); }

/* ---------------- 简易条形图 ---------------- */
.chart-bars { display: flex; flex-direction: column; gap: 9px; }
.chart-row { display: grid; grid-template-columns: 96px 1fr 74px; gap: 10px; align-items: center; font-size: 13px; }
.chart-row .bar { height: 16px; }
.chart-row .cnt { text-align: right; color: var(--c-text-2); font-variant-numeric: tabular-nums; }

/* ---------------- 移动端 ---------------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .admin-content { padding: 16px 14px 28px; }
  .topbar { padding: 0 14px; }
  .user-chip { display: none; }
  .detail-table th { width: 108px; }
}
