* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  background: #f4f6fa;
  color: #1d1d1f;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ===== 登录页 ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #fafbfc;
  position: relative;
}
.login-page::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% 15%, rgba(184,134,76,0.08), transparent),
    radial-gradient(ellipse 500px 350px at 85% 85%, rgba(184,134,76,0.06), transparent);
  pointer-events: none;
}
.login-card {
  background: #fff;
  padding: 48px 44px;
  border-radius: 16px;
  width: 420px;
  position: relative;
  z-index: 1;
  box-shadow:
    0 1px 3px rgba(0,0,0,0.04),
    0 20px 50px -20px rgba(0,0,0,0.12);
  border: 1px solid #f0f2f5;
}
.login-logo { text-align: center; margin-bottom: 36px; }

/* ===== 首次登录强制改密码页（全屏，不可跳过） ===== */
.force-cp-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #fafbfc;
  position: relative;
}
.force-cp-page::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% 15%, rgba(184,134,76,0.08), transparent),
    radial-gradient(ellipse 500px 350px at 85% 85%, rgba(184,134,76,0.06), transparent);
  pointer-events: none;
}
.force-cp-card {
  background: #fff;
  padding: 40px 36px;
  border-radius: 16px;
  width: 440px;
  max-width: calc(100vw - 32px);
  position: relative;
  z-index: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 20px 50px -20px rgba(0,0,0,0.12);
  border: 1px solid #f0f2f5;
}
.force-cp-title {
  font-size: 20px;
  font-weight: 700;
  color: #1d1d1f;
  text-align: center;
  margin-bottom: 10px;
}
.force-cp-desc {
  font-size: 13px;
  color: #86868b;
  text-align: center;
  margin-bottom: 26px;
  line-height: 1.6;
}

/* ===== 员工端常见问题展示页（响应式网格卡片） ===== */
.faqv-search { margin-bottom: 18px; }
.faqv-search input {
  width: 100%;
  max-width: 380px;
  padding: 10px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #f9f9f9;
  box-sizing: border-box;
  transition: border-color 0.2s, background 0.2s;
}
.faqv-search input:focus { border-color: #1d1d1f; background: #fff; }
.faqv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.faqv-item {
  background: #fff;
  border: 1px solid #ece8e1;
  border-radius: 14px;
  padding: 20px 20px 18px;
  transition: transform 0.2s, box-shadow 0.25s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.faqv-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #B8864C, #D4A574, #B8864C);
  opacity: 0;
  transition: opacity 0.25s;
}
.faqv-item::after {
  content: '';
  position: absolute;
  top: 12px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(184,134,76,0.08);
  opacity: 0;
  transition: opacity 0.25s;
}
.faqv-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px -10px rgba(184,134,76,0.3), 0 2px 6px rgba(0,0,0,0.04);
  border-color: #d4c4a8;
}
.faqv-item:hover::before { opacity: 1; }
.faqv-item:hover::after { opacity: 0.6; }
.faqv-q {
  font-size: 14px;
  font-weight: 700;
  color: #1d1d1f;
  margin-bottom: 12px;
  line-height: 1.55;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.faqv-tag {
  background: linear-gradient(135deg, #B8864C, #D4A574);
  color: #fff;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 8px;
  flex-shrink: 0;
  font-weight: 700;
  margin-top: 1px;
  letter-spacing: 0.8px;
  box-shadow: 0 2px 6px -2px rgba(184,134,76,0.5);
}
.faqv-a {
  font-size: 13px;
  color: #4a4a4a;
  line-height: 1.75;
  padding: 12px 14px;
  background: linear-gradient(135deg, #fdfaf4, #faf5ec);
  border-radius: 8px;
  border: 1px solid #f0e8d8;
  border-left: 3px solid #B8864C;
  white-space: pre-wrap;
  word-break: break-word;
}
.faqv-empty { text-align: center; padding: 28px; color: #999; font-size: 14px; }
/* 常见问题内容禁止复制 */
.faqv-q, .faqv-a {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
.faqv-item { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
.login-logo img { height: 72px; display: inline-block; }
.login-logo .tagline {
  font-size: 12px;
  color: #86868b;
  letter-spacing: 3px;
  margin-top: 8px;
  font-weight: 500;
}

.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: #515154;
  font-weight: 500;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e5e5ea;
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.18s ease;
  font-family: inherit;
  background: #fff;
  color: #1d1d1f;
}
.form-group input::placeholder { color: #c7c7cc; }
.form-group textarea { resize: vertical; min-height: 100px; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none;
  border-color: #B8864C;
  box-shadow: 0 0 0 3px rgba(184,134,76,0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.18s ease;
  font-weight: 600;
  font-family: inherit;
  gap: 6px;
}
.btn-primary {
  background: #1d1d1f;
  color: #fff;
  width: 100%;
  padding: 14px;
  font-size: 15px;
  letter-spacing: 2px;
}
.btn-primary:hover { background: #000; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,0.18); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-success { background: #B8864C; color: #fff; width: 100%; padding: 14px; font-size: 15px; letter-spacing: 2px; }
.btn-success:hover { background: #a0753f; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(184,134,76,0.25); }
.btn-danger { background: #ff3b30; color: #fff; }
.btn-danger:hover { background: #e0342b; }
.btn-default { background: #fff; color: #515154; border: 1.5px solid #e5e5ea; }
.btn-default:hover { background: #fafafa; border-color: #d1d1d6; color: #1d1d1f; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }

.error-msg {
  color: #ff3b30;
  font-size: 13px;
  text-align: left;
  margin-top: 12px;
  padding: 10px 14px;
  background: #fff2f1;
  border-radius: 8px;
  border: 1px solid #ffd5d2;
  display: none;
  align-items: center;
  gap: 6px;
}

/* ===== 主布局 ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid #f0f2f5;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.sidebar .logo {
  padding: 22px 20px;
  border-bottom: 1px solid #f0f2f5;
}
.sidebar .logo img { height: 32px; display: block; }
.sidebar .user-info {
  padding: 18px 20px;
  border-bottom: 1px solid #f0f2f5;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C9964A, #B8864C);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.sidebar .user-info .name { font-weight: 600; font-size: 14px; }
.sidebar .user-info .dept { font-size: 12px; color: #86868b; }
.role-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}
.role-admin { background: #fff2f1; color: #ff3b30; }
.role-employee { background: #f0f7ff; color: #007aff; }

.sidebar nav { padding: 12px 0; flex: 1; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: #515154;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: #fafafa; color: #1d1d1f; }
.sidebar nav a.active {
  background: #fdf8f1;
  color: #B8864C;
  border-left-color: #B8864C;
  font-weight: 600;
}
.sidebar nav a .icon { font-size: 17px; width: 20px; text-align: center; }
.sidebar .logout {
  padding: 14px 20px;
  border-top: 1px solid #f0f2f5;
  cursor: pointer;
  color: #86868b;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s;
}
.sidebar .logout:hover { color: #ff3b30; background: #fffaf9; }

.main { flex: 1; padding: 28px 36px; overflow-y: auto; background: #f4f6fa; }
.page-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 22px;
  color: #1d1d1f;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 18px;
  border: 1px solid #f0f2f5;
}
.card h3 { font-size: 15px; margin-bottom: 18px; color: #1d1d1f; font-weight: 600; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  border: 1px solid #f0f2f5;
}
.stat-card .label { font-size: 12px; color: #86868b; margin-bottom: 6px; font-weight: 500; }
.stat-card .value { font-size: 26px; font-weight: 700; color: #1d1d1f; }
.stat-card.accent .value { color: #B8864C; }

.welcome-bar {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #f0f2f5;
}
.welcome-bar .text { font-size: 14px; color: #515154; }
.welcome-bar .text .hi { font-weight: 700; color: #1d1d1f; font-size: 16px; }
.welcome-bar .date-box {
  background: #fafbfc;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  color: #515154;
}

.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

.filter-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filter-bar .form-group { margin-bottom: 0; min-width: 150px; }
.filter-bar label { font-size: 12px; color: #86868b; margin-bottom: 6px; display: block; font-weight: 500; }
.filter-bar input, .filter-bar select {
  padding: 9px 12px;
  border: 1.5px solid #e5e5ea;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  transition: all 0.15s;
  min-width: 140px;
}
.filter-bar input:focus, .filter-bar select:focus {
  outline: none; border-color: #B8864C;
  box-shadow: 0 0 0 3px rgba(184,134,76,0.1);
}
.filter-bar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.quick-filters {
  display: flex;
  gap: 8px;
  min-width: auto;
  align-items: flex-end;
}
.btn-quick {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  background: #fdf8f1;
  color: #B8864C;
  border: 1.5px solid #e8dcc4;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
.btn-quick:hover {
  background: #B8864C;
  color: #fff;
  border-color: #B8864C;
}
.btn-quick:active { transform: scale(0.97); }

table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table th, table td { padding: 12px 16px; text-align: left; }
table th {
  background: #fafbfc;
  font-weight: 600;
  color: #515154;
  font-size: 13px;
  border-bottom: 1px solid #e5e5ea;
}
table th:first-child { border-top-left-radius: 8px; }
table th:last-child { border-top-right-radius: 8px; }
table tbody tr:hover { background: #fafbfc; }
table tbody tr:not(:last-child) td { border-bottom: 1px solid #f0f2f5; }
table tbody tr.total-row { background: #fdf8f1; font-weight: 600; }
table tbody tr.total-row td { color: #B8864C; }

.tabs {
  display: flex;
  gap: 28px;
  margin-bottom: 22px;
  border-bottom: 1px solid #f0f2f5;
}
.tab {
  padding: 12px 0;
  cursor: pointer;
  font-size: 14px;
  color: #86868b;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.tab:hover { color: #1d1d1f; }
.tab.active { color: #1d1d1f; border-bottom-color: #B8864C; font-weight: 700; }

.chart-container { height: 380px; }
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .chart-row { grid-template-columns: 1fr; } }

.toast {
  position: fixed; top: 24px; left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  z-index: 9999;
  box-shadow: 0 8px 30px rgba(0,0,0,0.18);
  animation: slideDown 0.28s ease;
  font-weight: 500;
}
.toast.success { background: #34c759; }
.toast.error { background: #ff3b30; }
.toast.info { background: #007aff; }
@keyframes slideDown {
  from { opacity: 0; transform: translate(-50%, -16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: 14px;
  padding: 28px;
  width: 440px;
  max-width: 90vw;
  box-shadow: 0 30px 80px rgba(0,0,0,0.2);
}
.modal h3 { margin-bottom: 20px; font-size: 17px; font-weight: 700; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.empty-state { text-align: center; padding: 60px 20px; color: #86868b; }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.tag-blue { background: #f0f7ff; color: #007aff; }
.tag-green { background: #eafaf1; color: #34c759; }
.tag-gold { background: #fdf8f1; color: #B8864C; }
.tag-red { background: #fff2f1; color: #ff3b30; }
.tag-off { background: #f3f4f6; color: #9ca3af; text-decoration: line-through; }

.form-group .perm-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  margin-bottom: 8px;
}
.form-group .perm-check input { width: 16px; height: 16px; accent-color: #B8864C; cursor: pointer; }
.form-group .perm-check input:disabled { cursor: not-allowed; opacity: 0.5; }
.form-group .perm-check:has(input:disabled) { color: #9ca3af; }

.bags-iframe {
  width: 100%;
  height: 100vh;
  border: none;
  display: block;
}

@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; flex-direction: row; align-items: center;
    padding: 8px 12px; height: auto; flex-shrink: 0;
    justify-content: space-between;
  }
  .sidebar .logo { padding: 0; border-bottom: none; }
  .sidebar .logo img { height: 28px; }
  .sidebar .user-info { display: none; }
  .sidebar nav {
    display: flex; padding: 0; flex: 1; gap: 0; justify-content: center;
  }
  .sidebar nav a {
    flex-direction: column; gap: 2px; padding: 6px 10px;
    font-size: 11px; border-left: none; border-bottom: 2px solid transparent;
    flex: 1; text-align: center;
  }
  .sidebar nav a.active { border-bottom-color: #B8864C; border-left: none; }
  .sidebar nav a .icon { font-size: 18px; }
  .sidebar .logout {
    padding: 8px; border-top: none; font-size: 18px; color: #ff3b30;
  }
  .sidebar .logout::before { content: '⏻'; }
  .sidebar .logout { font-size: 0; }
  .sidebar .logout::before { font-size: 20px; }
  .main { padding: 12px 12px 20px; overflow-y: auto; }
  .page-title { font-size: 17px; margin-bottom: 14px; }
  .card { padding: 14px; }
  .card h3 { font-size: 14px; }
  .form-row { flex-direction: column; gap: 0; }
  .welcome-bar { flex-direction: column; gap: 10px; align-items: flex-start; padding: 14px; }
  .welcome-bar .date-box { align-self: flex-end; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 12px; }
  .stat-card .value { font-size: 22px; }
  .filter-bar { flex-direction: column; gap: 10px; }
  .filter-bar .form-group { min-width: 100%; }
  .filter-bar .actions { width: 100%; }
  .filter-bar .actions .btn { flex: 1; }
  .quick-filters { width: 100%; }
  .quick-filters .btn-quick { flex: 1; text-align: center; }
  table { font-size: 12px; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table th, table td { padding: 8px 10px; white-space: nowrap; }
  .chart-container { height: 280px; }
  .chart-row { grid-template-columns: 1fr; }
  .tabs { gap: 16px; }
  .modal { width: 92vw; padding: 20px; }
  .modal h3 { font-size: 15px; }
  .toast { font-size: 13px; padding: 10px 18px; max-width: 90vw; }
  .bags-iframe { height: calc(100vh - 56px); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card .value { font-size: 20px; }
  .sidebar nav a { padding: 6px 6px; font-size: 10px; }
  .sidebar nav a .icon { font-size: 16px; }
  .card { padding: 12px; }
  .page-title { font-size: 16px; }
  .btn-sm { padding: 5px 10px; font-size: 12px; }
  .btn-success, .btn-primary { padding: 12px; font-size: 14px; }
}
