* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: -apple-system, 'Microsoft YaHei', 'PingFang SC', sans-serif;
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  min-height: 100vh;
  color: #333;
}
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}
.login-box {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}
.login-box h1 {
  text-align: center;
  color: #2e7d32;
  margin-bottom: 8px;
  font-size: 24px;
}
.login-box .subtitle {
  text-align: center;
  color: #888;
  margin-bottom: 32px;
  font-size: 14px;
}
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  color: #555;
}
.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.2s;
  outline: none;
}
.form-group input:focus {
  border-color: #4caf50;
}
/* 记住密码复选框 */
.remember-row {
  margin: -4px 0 16px 0;
}
.remember-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #666;
  user-select: none;
}
.remember-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #4caf50;
  cursor: pointer;
  margin: 0;
}
.btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary {
  background: #4caf50;
  color: white;
}
.btn-primary:hover { background: #388e3c; }
.btn-secondary {
  background: #1976d2;
  color: white;
}
.btn-secondary:hover { background: #1565c0; }
.btn-danger {
  background: #e53935;
  color: white;
}
.btn-danger:hover { background: #c62828; }
.error-msg {
  color: #e53935;
  font-size: 14px;
  margin-top: 8px;
  text-align: center;
  min-height: 20px;
}
.hint {
  text-align: center;
  color: #999;
  font-size: 12px;
  margin-top: 16px;
}
.footer-author {
  text-align: center;
  color: #bbb;
  font-size: 11px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

/* 主页面布局 */
.header {
  background: #2e7d32;
  color: white;
  padding: 0 16px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
  gap: 8px;
}
.header h1 { font-size: 18px; white-space: nowrap; }
.header .user-info { font-size: 13px; opacity: 0.9; }
.header .logout-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.main-content {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 16px;
}
.card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.card h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: #333;
  border-left: 4px solid #4caf50;
  padding-left: 12px;
}
/* 一键全员到齐按钮 */
.btn-quick-confirm {
  background: linear-gradient(135deg, #43a047, #2e7d32);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 20px 60px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(76,175,80,0.35);
  transition: all 0.2s;
  line-height: 1.5;
  min-width: 260px;
}
.btn-quick-confirm:hover {
  background: linear-gradient(135deg, #388e3c, #1b5e20);
  box-shadow: 0 6px 24px rgba(76,175,80,0.5);
  transform: translateY(-1px);
}
.btn-quick-confirm:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(76,175,80,0.3);
}
.btn-quick-confirm:disabled {
  background: #bdbdbd;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}
/* 今日状态标签 */
.status-tag {
  display: inline-block;
  padding: 6px 20px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 600;
  margin: 4px;
}
.status-tag.confirmed {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}
.status-tag.pending {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffcc80;
}
.status-tag.auto-submitted {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}
/* 统计卡片 — 纯 flexbox，兼容 IE9+ */
.stats-grid {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -8px 20px -8px;
}
.stat-card {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  width: 23%;
  margin: 0 1% 16px 1%;
  box-sizing: border-box;
  display: inline-block;
}
.stat-card .num {
  font-size: 32px;
  font-weight: 700;
  color: #2e7d32;
  white-space: nowrap;
}
.stat-card .label {
  font-size: 14px;
  color: #666;
  margin-top: 4px;
}
@media (max-width: 900px) {
  .stat-card {
    width: 48%;
    margin: 0 1% 16px 1%;
  }
}
@media (max-width: 600px) {
  .stat-card {
    width: 98%;
    margin: 0 1% 8px 1%;
  }
}

/* 表单 */
.date-picker {
  padding: 10px 14px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
}
.date-picker:focus { border-color: #4caf50; }
.student-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin: 16px 0;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
  background: #f9f9f9;
  border-radius: 8px;
}
.student-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.student-tag input { cursor: pointer; }
.student-tag.absent {
  background: #ffebee;
  color: #c62828;
}
.student-tag.present {
  background: #e8f5e9;
  color: #2e7d32;
}
.action-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  text-align: left;
}
th {
  background: #f5f5f5;
  font-weight: 600;
  position: sticky;
  top: 0;
}
tr:hover { background: #fafafa; }
.empty-state {
  text-align: center;
  padding: 48px;
  color: #999;
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}
.badge-green { background: #e8f5e9; color: #2e7d32; }
.badge-red { background: #ffebee; color: #c62828; }
.badge-blue { background: #e3f2fd; color: #1565c0; }
.loading {
  text-align: center;
  padding: 32px;
  color: #999;
}
@media (max-width: 600px) {
  .login-box { margin: 16px; padding: 24px; }
  .main-content { padding: 0 8px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .student-list { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
}

/* ===== 管理员后台侧边栏布局 ===== */
.admin-layout {
  display: flex;
  min-height: calc(100vh - 52px);
}
.admin-sidebar {
  width: 180px;
  background: #fff;
  border-right: 1px solid #e0e0e0;
  padding: 16px 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 8px rgba(0,0,0,0.04);
}
.sidebar-title {
  font-size: 12px;
  color: #999;
  padding: 0 20px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 2px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  color: #555;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.sidebar-item:hover {
  background: #e3f2fd;
  color: #1565c0;
}
.sidebar-item.active {
  background: #e3f2fd;
  color: #1565c0;
  font-weight: 600;
  border-left-color: #1565c0;
}
.sidebar-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}
.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  font-size: 11px;
  color: #bbb;
  border-top: 1px solid #eee;
}
.admin-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  max-width: 1000px;
}
.page-section {
  display: none;
}
.page-section.active {
  display: block;
}

/* ===== 移动端顶部导航 ===== */
.mobile-nav {
  display: none;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-nav-scroll {
  display: flex;
  white-space: nowrap;
  padding: 0 8px;
}
.mobile-nav-item {
  display: inline-block;
  padding: 10px 12px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
  flex-shrink: 0;
}
.mobile-nav-item:hover {
  color: #1565c0;
}
.mobile-nav-item.active {
  color: #1565c0;
  font-weight: 600;
  border-bottom-color: #1565c0;
}

/* ===== 表格横向滚动容器 ===== */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  border: 1px solid #eee;
}
.table-scroll table {
  min-width: 600px;
}

/* ===== 响应式断点：平板和手机 ===== */
@media (max-width: 768px) {
  .admin-sidebar {
    display: none;
  }
  .mobile-nav {
    display: block;
  }
  .admin-layout {
    flex-direction: column;
    min-height: auto;
  }
  .admin-content {
    padding: 12px;
    min-width: auto;
    overflow-x: hidden;
  }
  .header {
    padding: 8px 12px;
    min-height: 48px;
  }
  .header h1 {
    font-size: 15px;
  }
  .header .user-info {
    display: none;
  }
  .card {
    padding: 16px;
    margin-bottom: 12px;
  }
  .card h2 {
    font-size: 16px;
  }
  .main-content {
    padding: 0 8px;
    margin: 12px auto;
  }
  .action-bar {
    gap: 8px;
  }
  .action-bar .btn,
  .action-bar .date-picker {
    font-size: 14px;
    padding: 8px 12px;
  }
  .btn-quick-confirm {
    min-width: auto;
    width: 100%;
    padding: 16px 24px;
  }
  .stats-grid {
    margin: 0 -4px 12px -4px;
  }
  .stat-card {
    width: 48%;
    margin: 0 1% 10px 1%;
    padding: 14px;
  }
  .stat-card .num {
    font-size: 24px;
  }
  .stat-card .label {
    font-size: 12px;
  }
  .student-list {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    max-height: 240px;
  }
  th, td {
    padding: 8px;
    font-size: 13px;
  }
  .login-box {
    margin: 16px;
    padding: 24px;
    width: auto;
  }
}

@media (max-width: 480px) {
  .stat-card {
    width: 98%;
    margin: 0 1% 8px 1%;
  }
  .header h1 span {
    display: none;
  }
}

/* ===== 假期配置标签样式 ===== */
.tag-item {
  display: inline-flex;
  align-items: center;
  background: #e3f2fd;
  color: #1565c0;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  gap: 6px;
}
.tag-item.makeup {
  background: #e8f5e9;
  color: #2e7d32;
}
.tag-remove {
  cursor: pointer;
  font-weight: bold;
  font-size: 15px;
  line-height: 1;
  opacity: 0.7;
}
.tag-remove:hover {
  opacity: 1;
}

/* ===== 假期提示样式 ===== */
#holidayWarning {
  animation: fadeIn 0.3s ease;
}
#lockWarning {
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Toast 通知系统 ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 14px 22px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  max-width: 360px;
  word-break: break-word;
  line-height: 1.5;
}
.toast-success { background: #43a047; }
.toast-error   { background: #e53935; }
.toast-warn    { background: #f9a825; color: #333; }
.toast-info    { background: #1e88e5; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(60px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateX(60px); }
}

@media (max-width: 480px) {
  .toast-container { top: 10px; right: 10px; left: 10px; }
  .toast { max-width: 100%; font-size: 13px; padding: 12px 16px; }
}
