* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
}

.view {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.view.hidden {
  display: none;
}

/* 头部 */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #ddd;
  margin-bottom: 20px;
}

h1 {
  font-size: 24px;
  color: #333;
}

/* 搜索框 */
.search-box {
  margin-bottom: 15px;
}

#search-input {
  width: 100%;
  font-size: 16px;
  height: 44px;
  padding: 0 12px;
}

/* 拼音导航 */
.pinyin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 15px;
  justify-content: center;
}

.pinyin-nav .letter-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
}

.pinyin-nav .letter-btn:hover {
  background: #f0f0f0;
}

.pinyin-nav .letter-btn.active {
  background: #4a90d9;
  color: #fff;
  border-color: #4a90d9;
}

/* 时段状态 */
.time-status {
  padding: 10px;
  margin-bottom: 15px;
  border-radius: 4px;
  text-align: center;
}

.time-status.in-time {
  background: #e8f5e9;
  color: #2e7d32;
}

.time-status.out-time {
  background: #ffebee;
  color: #c62828;
}

/* 学生列表 */
.student-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.student-card {
  padding: 15px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  text-align: center;
}

.student-card .name {
  font-size: 16px;
  color: #333;
  margin-bottom: 5px;
}

.student-card .student-id {
  font-size: 12px;
  color: #666;
  margin-bottom: 10px;
}

.student-card .checkin-btn {
  width: 100%;
  padding: 8px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.student-card .checkin-btn:hover {
  background: #3a7bc8;
}

.student-card.checked {
  background: #e8f5e9;
  border-color: #81c784;
}

.student-card.checked .checkin-btn {
  background: #81c784;
  cursor: default;
}

.student-card.out-time .checkin-btn {
  background: #ccc;
  cursor: default;
}

.error-msg {
  color: #c62828;
  text-align: center;
  margin-top: 10px;
}

.result-msg {
  margin-top: 10px;
  text-align: center;
}

.result-msg.success {
  color: #2e7d32;
}

.result-msg.error {
  color: #c62828;
}

/* 管理面板 */
.admin-tabs {
  display: flex;
  gap: 10px;
}

.tab-btn {
  padding: 10px 20px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.tab-btn:hover {
  background: #f0f0f0;
}

.tab-btn.active {
  background: #4a90d9;
  color: #fff;
  border-color: #4a90d9;
}

.tab-content {
  padding: 20px;
  background: #fff;
  border-radius: 8px;
}

.tab-content.hidden {
  display: none;
}

/* 导入区域 */
.import-trigger {
  text-align: center;
  padding: 8px 0 20px;
}
/* 配置表单 */
.config-form label {
  display: block;
  margin-bottom: 15px;
}

.config-form input {
  margin-left: 10px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* 统计 */
.stats-header {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 20px;
}

.stats-overview {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.stats-overview .stats-summary {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 0;
}

.stats-overview .stat-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  text-align: left;
}

.stats-overview .stat-card h3 {
  margin-bottom: 0;
  font-size: 14px;
}

.stats-overview .stat-value {
  font-size: 22px;
}

#attendance-chart {
  flex-shrink: 0;
  width: 200px;
  height: 200px;
}

#time-distribution {
  height: 220px;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 30px;
}

.stat-card {
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  text-align: center;
  border: 1px solid #ddd;
}

.stat-card h3 {
  color: #666;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 28px;
  font-weight: bold;
  color: #4a90d9;
}

.stats-detail h3 {
  margin: 20px 0 10px;
  color: #333;
}

/* 缺勤/签到列表 */
.absent-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 0;
}

.records-list {
  max-height: 200px;
  overflow-y: auto;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 4px;
}

.absent-item {
  padding: 10px 8px;
  background: #fff5f5;
  border: 1px solid #ffcdd2;
  border-radius: 6px;
  text-align: center;
  color: #c62828;
}

.absent-item .absent-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 3px;
}

.absent-item .absent-id {
  font-size: 11px;
  color: #e57373;
}

/* Toast 提示 */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px 30px;
  background: #333;
  color: #fff;
  border-radius: 4px;
  z-index: 1000;
}

.toast.hidden {
  display: none;
}

.toast.success {
  background: #2e7d32;
}

.toast.error {
  background: #c62828;
}

/* 名单管理 */

.roster-section {
  margin-top: 24px;
}

.roster-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.roster-header h3 {
  color: #333;
  font-size: 15px;
}

.roster-count {
  margin-left: 6px;
  color: #888;
  font-size: 13px;
  font-weight: normal;
}

.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.roster-table th,
.roster-table td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.roster-table thead tr {
  background: #f5f5f5;
}

.roster-table th {
  color: #555;
  font-weight: 600;
}

.roster-table tbody tr:hover {
  background: #fafafa;
}

.roster-table td:first-child {
  color: #aaa;
  width: 40px;
}

.roster-empty {
  text-align: center;
  color: #888;
  padding: 20px 0;
}
