/* ===== 管理端布局 ===== */
.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, rgba(10, 15, 30, 0.98), rgba(19, 26, 46, 0.98));
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  backdrop-filter: blur(16px);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
.sidebar nav {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 8px;
}
.sidebar nav::-webkit-scrollbar { width: 4px; }
.sidebar nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  font-weight: 700; font-size: 15px;
  flex-shrink: 0;
  background: rgba(99, 102, 241, 0.03);
}
.sidebar-brand .brand-mark {
  width: 32px; height: 32px; font-size: 13px; border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.sidebar-nav { flex: 1; padding: 14px 12px; }

.nav-group { margin-bottom: 22px; }
.nav-group-label,
.sidebar-group-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 12px;
  margin-bottom: 8px;
  font-weight: 700;
  opacity: 0.7;
}
.sidebar-group { margin-bottom: 14px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 2px;
  border: 1px solid transparent;
  transition: all 0.15s var(--anim);
  text-decoration: none;
  font-weight: 500;
}
.nav-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}
.nav-item.active {
  color: var(--primary-light);
  background: var(--primary-soft);
  border-color: rgba(99, 102, 241, 0.15);
  font-weight: 600;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.08);
}

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.1);
}

/* ===== 管理端主区域 ===== */
.admin-main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image: radial-gradient(ellipse 60% 40% at 70% 10%, rgba(99, 102, 241, 0.04), transparent);
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 15, 30, 0.5);
  backdrop-filter: blur(12px);
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.admin-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
  color: var(--text-strong);
}
.admin-header .muted {
  color: var(--muted);
  font-size: 13px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.admin-tab-panel {
  padding: 28px 32px;
  flex: 1;
  animation: fadeIn 0.2s ease;
}
.admin-tab-panel.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ===== section-header ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
.section-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--text-strong);
}

/* ===== H5 员工端 ===== */
.mobile-shell {
  width: min(480px, calc(100% - 24px));
  margin: 0 auto;
  padding: 0 0 100px;
}

.mobile-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  background: rgba(10, 15, 30, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.mobile-topbar .back-btn { color: var(--primary-light); font-size: 14px; font-weight: 600; }
.mobile-topbar .mobile-title { font-weight: 700; font-size: 16px; color: var(--text-strong); }

.user-card {
  display: flex; align-items: center; gap: 16px;
  padding: 22px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(6, 182, 212, 0.06));
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-lg);
  margin: 16px 0;
  position: relative; overflow: hidden;
}
.user-card::before {
  content: ''; position: absolute; top: -50%; right: -20%;
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.1), transparent 70%);
  pointer-events: none;
}
.user-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  display: grid; place-items: center;
  font-size: 20px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.user-info { flex: 1; position: relative; }
.user-name { font-size: 18px; font-weight: 700; color: var(--text-strong); }
.user-dept { color: var(--muted); font-size: 13px; margin-top: 3px; }

.func-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 18px;
}
.func-btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 8px;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; color: var(--muted);
  cursor: pointer; transition: all 0.2s var(--anim);
  font-weight: 500;
}
.func-btn .func-icon { font-size: 24px; }
.func-btn span:last-child { font-size: 12px; font-weight: 600; }
.func-btn:hover {
  border-color: rgba(99, 102, 241, 0.3);
  background: var(--primary-soft);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}
.func-btn.active-tab {
  background: var(--primary-soft);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--primary-light);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.1);
}

.tab-panel { display: block; }
.tab-panel.hidden { display: none; }

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.panel-header h3 { margin: 0; font-size: 17px; font-weight: 700; color: var(--text-strong); }

.card-list { display: grid; gap: 10px; }

.slip-card {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.2s var(--anim);
}
.slip-card:hover {
  border-color: rgba(99, 102, 241, 0.25);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.slip-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.slip-period { font-size: 14px; font-weight: 700; color: var(--text-strong); }
.slip-amount { font-size: 22px; font-weight: 700; color: var(--primary-light); }
.slip-meta { display: flex; gap: 10px; align-items: center; }
.slip-label { font-size: 11px; color: var(--muted); }

.empty-card {
  padding: 48px 20px; text-align: center; color: var(--muted);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.015);
  border: 1px dashed var(--line);
  font-size: 14px;
}
.empty-card::before { content: '📭'; display: block; font-size: 28px; margin-bottom: 10px; }

/* ===== H5 弹窗详情 ===== */
.detail-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--muted); font-size: 13px; }
.detail-value { font-size: 14px; font-weight: 600; color: var(--text); }
.detail-value.highlight { color: var(--primary-light); font-size: 18px; }

/* ===== Toast (pages override) ===== */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 9999; display: flex; flex-direction: column;
  gap: 8px; pointer-events: none;
}
.toast {
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s var(--anim-spring), toastOut 0.3s var(--anim) 2.7s forwards;
  pointer-events: auto;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }

/* ===== 管理端响应式 ===== */

/* 汉堡菜单按钮(移动端) */
.sidebar-toggle {
  display: none;
  position: fixed; top: 12px; left: 12px; z-index: 1100;
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--primary); color: #fff; border: none;
  font-size: 20px; cursor: pointer;
  box-shadow: 0 2px 12px rgba(99,102,241,0.4);
  align-items: center; justify-content: center;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
}

/* PC端 (>1024px) — 默认侧边栏布局，不需要额外样式 */

/* 平板 (768-1024px) — 窄侧边栏 */
@media (max-width: 1024px) {
  .admin-layout { grid-template-columns: 220px 1fr; }
  .sidebar { width: 220px; }
  .nav-item { font-size: 12px; padding: 7px 10px; }
  .sidebar-brand { padding: 16px; font-size: 14px; }
  .admin-header { padding: 20px 24px 16px; }
  .admin-tab-panel { padding: 20px; }
}

/* 手机 (<768px) — 侧边栏变抽屉 */
@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: -280px; top: 0; bottom: 0;
    width: 260px; z-index: 1050;
    transition: left 0.3s ease;
    box-shadow: none;
  }
  .sidebar.open { left: 0; box-shadow: 4px 0 24px rgba(0,0,0,0.3); }
  .sidebar.open + .sidebar-overlay { display: block; }
  .admin-main { margin-left: 0; }
  .admin-header {
    padding: 14px 16px 12px 60px;
    flex-direction: column; gap: 8px;
    position: sticky; top: 0; z-index: 100;
    background: rgba(10,15,30,0.95); backdrop-filter: blur(12px);
  }
  .admin-header h2 { font-size: 16px; }
  .header-actions { gap: 8px; }
  .header-actions .btn { padding: 0 10px; min-height: 32px; font-size: 12px; }
  .admin-tab-panel { padding: 14px; }
  .section-header { flex-direction: column; gap: 10px; align-items: flex-start; }
  .section-header h2 { font-size: 16px; }

  /* 表格横向滚动 */
  .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 600px; }
  .data-table th, .data-table td { padding: 8px 10px; font-size: 12px; white-space: nowrap; }

  /* 表单 */
  .filter-bar { flex-direction: column; gap: 8px; }
  .filter-bar input, .filter-bar select { width: 100%; }

  /* 卡片 */
  .card { padding: 14px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
}

/* 超小屏 (<480px) */
@media (max-width: 480px) {
  .admin-header { padding: 12px 12px 10px 52px; }
  .admin-tab-panel { padding: 10px; }
  .stats-grid { grid-template-columns: 1fr; }
  .data-table { min-width: 500px; font-size: 11px; }
  .btn { font-size: 12px; padding: 6px 12px; }
  .btn-sm { font-size: 11px; padding: 4px 8px; }
}
