:root {
  --primary: #2f7fe0;
  --primary-dark: #1a56b0;
  --grad: linear-gradient(135deg, #4a90f0 0%, #2563eb 100%);
  --bg: #eef3fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #8494ab;
  --border: #e4eaf3;
  --danger: #ef4444;
  --ok: #16a34a;
  --shadow-sm: 0 2px 8px rgba(31, 78, 121, 0.08);
  --shadow: 0 8px 24px rgba(31, 78, 121, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- 登录/注册 ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  background: linear-gradient(150deg, #1e5bb8 0%, #4a90f0 55%, #7fc1ff 100%);
}
.auth-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(20, 50, 90, 0.3);
  padding: 34px 28px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.auth-logo {
  font-size: 46px;
  width: 84px; height: 84px;
  margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad);
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.35);
}
.auth-card h1 { font-size: 22px; margin: 6px 0 4px; color: var(--text); }
.auth-sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.auth-tabs {
  display: flex; margin-bottom: 20px; padding: 4px;
  background: #f1f5fb; border-radius: 12px;
}
.auth-tab {
  flex: 1; padding: 10px; border: none; background: transparent; cursor: pointer;
  font-size: 15px; color: var(--muted); border-radius: 9px; transition: .18s;
}
.auth-tab.active { background: #fff; color: var(--primary-dark); font-weight: 700; box-shadow: var(--shadow-sm); }
.auth-hint { color: var(--muted); font-size: 12px; margin-top: 16px; }
.auth-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 8px 0; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 20px; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; font-size: 15px; font-weight: 600; transition: .18s; white-space: nowrap;
  min-height: 44px;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { transform: translateY(1px); box-shadow: 0 3px 8px rgba(37, 99, 235, 0.28); }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { background: #f6f9fd; }
.btn-ghost:active { transform: translateY(1px); }
.btn-sm { padding: 7px 13px; font-size: 13px; min-height: 34px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; text-align: left; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field input[type="text"], .field input[type="password"], .field input[type="date"], .field input[type="tel"], .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 12px; font-size: 16px;
  font-family: inherit; background: #fbfdff; color: var(--text); transition: .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 4px rgba(47, 127, 224, 0.12);
}
.field textarea { resize: vertical; }
.req { color: var(--danger); }

/* 有/无 分段开关 */
.radio-group { display: flex; gap: 8px; }
.radio-group label { position: relative; flex: 1; margin: 0; }
.radio-group input { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-group span {
  display: block; text-align: center; padding: 11px 0; border: 1.5px solid var(--border);
  border-radius: 12px; font-size: 15px; font-weight: 600; color: var(--muted);
  background: #fbfdff; cursor: pointer; transition: .16s; user-select: none;
}
.radio-group input:checked + span {
  background: var(--grad); border-color: transparent; color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* 验证码 */
.captcha-row { display: flex; gap: 8px; align-items: stretch; }
.captcha-row img {
  height: 46px; width: 132px; border: 1.5px solid var(--border); border-radius: 12px;
  cursor: pointer; background: #eef3fb; flex-shrink: 0;
}
.captcha-row input { flex: 1; }

/* 公告 */
.emoji-bar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.emoji-bar button { border: 1px solid var(--border); background: #f7fafd; border-radius: 8px; font-size: 20px; padding: 4px 8px; cursor: pointer; line-height: 1; }
.emoji-bar button:hover { background: #eaf2fd; }
.announce-box { max-width: 420px; }
.announce-head { font-size: 18px; font-weight: 800; color: var(--primary-dark); margin-bottom: 12px; }
.announce-body { white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.7; color: var(--text); margin-bottom: 18px; max-height: 60vh; overflow-y: auto; }

/* ---------- 应用布局 ---------- */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  height: 58px; padding: 0 16px; z-index: 10;
  background: linear-gradient(135deg, #1e5bb8 0%, #2f7fe0 100%);
  color: #fff; position: sticky; top: 0; box-shadow: 0 2px 12px rgba(20, 50, 90, 0.18);
}
.brand { font-size: 17px; font-weight: 800; letter-spacing: .5px; }
.header-right { display: flex; align-items: center; gap: 8px; }
.user-badge {
  font-size: 12px; color: #fff; background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.25); padding: 5px 12px; border-radius: 999px;
}
.app-header .btn-ghost { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.3); color: #fff; box-shadow: none; min-height: 34px; }
.app-header .btn-ghost:hover { background: rgba(255,255,255,0.26); }

/* 标签导航 */
.tabs {
  display: flex; gap: 8px; background: #fff; padding: 8px 12px;
  border-bottom: 1px solid var(--border); position: sticky; top: 58px; z-index: 9;
  box-shadow: 0 2px 8px rgba(31, 78, 121, 0.05);
}
.tab {
  flex: 1; border: none; background: #f1f5fb; border-radius: 12px; padding: 11px 4px;
  cursor: pointer; font-size: 14px; color: var(--muted); font-weight: 600; transition: .18s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tab.active {
  background: var(--grad); color: #fff; box-shadow: 0 6px 14px rgba(37, 99, 235, 0.32);
}
.admin-only, .teacher-only { display: none; }

.content { max-width: 720px; margin: 0 auto; padding: 16px 14px 60px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card {
  background: var(--card); border-radius: 18px; padding: 20px 16px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  margin: 0 0 16px; font-size: 16px; color: var(--text); font-weight: 800;
  display: flex; align-items: center; gap: 8px;
}
.card-title::before { content: ''; width: 4px; height: 18px; background: var(--grad); border-radius: 2px; }
.card-desc { margin: -8px 0 16px; color: var(--muted); font-size: 13px; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 14px; }
.field-full { grid-column: 1 / -1; }
.form-actions { margin-top: 16px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.form-msg { color: var(--ok); font-size: 14px; margin: 0; min-height: 20px; }
.form-msg.error { color: var(--danger); }

/* ---------- 筛选条 / 表格 ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; margin-bottom: 14px; }
.filter-bar label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.filter-bar input[type="date"], .filter-bar input[type="text"], .filter-bar select {
  height: 42px; box-sizing: border-box; padding: 0 11px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit; background: #fbfdff; min-width: 110px;
}
.filter-bar .btn { height: 42px; min-height: 42px; padding: 0 16px; font-size: 14px; box-sizing: border-box; border-radius: 10px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 860px; }
table.data th, table.data td { padding: 9px 10px; border-bottom: 1px solid #eef2f7; text-align: left; white-space: nowrap; }
table.data th { background: #f3f7fd; color: var(--primary-dark); font-weight: 700; }
table.data tbody tr:hover { background: #f8fbff; }
table.data td.remark-cell { white-space: normal; min-width: 140px; max-width: 240px; }
.empty { padding: 36px; text-align: center; color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); font-size: 13px; }

.export-row { margin-bottom: 12px; }

/* 按营地分组 */
.group-head {
  background: linear-gradient(135deg, #eaf2fd 0%, #dcebfd 100%); color: var(--primary-dark);
  font-weight: 700; padding: 10px 14px; border: 1px solid #d5e4f7; border-bottom: none;
  border-radius: 12px 12px 0 0; font-size: 14px; margin-top: 14px; display: flex; align-items: center; gap: 6px;
}
.group-head:first-child { margin-top: 0; }
.group-head .muted { font-weight: 500; }
.group-head + table.data { border-radius: 0 0 12px 12px; }

/* ---------- 预设管理 ---------- */
.preset-cols { display: grid; grid-template-columns: 1fr; gap: 18px; margin-bottom: 14px; }
.preset-label { font-size: 14px; font-weight: 700; color: var(--text); display: block; margin-bottom: 8px; }
.preset-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 44px; padding: 10px; border: 1.5px dashed var(--border); border-radius: 12px; }
.preset-tag {
  display: inline-flex; align-items: center; gap: 7px; background: #eaf2fd; border: 1px solid #c8dcf5;
  color: var(--primary-dark); padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.preset-tag button { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 0 2px; line-height: 1; }
.preset-tag button:hover { color: var(--danger); }
.preset-add { display: flex; gap: 8px; margin-top: 10px; }
.preset-add input { flex: 1; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 14px; font-family: inherit; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 35, 60, 0.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-box { background: #fff; border-radius: 18px; padding: 24px; width: 100%; max-width: 360px; box-shadow: var(--shadow); }
.modal-box h3 { margin: 0 0 16px; color: var(--text); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .app-header { flex-wrap: wrap; height: auto; min-height: 56px; padding: 8px 14px; gap: 6px; }
  .user-badge { display: none; }
  .tabs { top: 0; position: static; }
  .content { padding: 14px 12px 40px; }
  .card { padding: 18px 14px; }
}
