:root {
  --blue: #2f7bff;
  --blue-dark: #1f63e0;
  --blue-soft: #eaf2ff;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #1c2635;
  --muted: #7b8798;
  --line: #e7edf5;
  --green: #17a35a;
  --green-soft: #e8f8ef;
  --orange: #e8861c;
  --orange-soft: #fff2e5;
  --red: #e14b52;
  --shadow: 0 3px 16px rgba(28, 54, 93, .07);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
.hidden { display: none !important; }
.spacer { flex: 1 1 auto; }
.muted { color: var(--muted); font-size: 12.5px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 8px 0 0; }
code { background: #f0f4fa; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ------------------------------------------------ 顶栏 */
.app-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.header-inner {
  max-width: 1180px; margin: 0 auto; padding: 11px 20px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, #4b90ff, #1f63e0);
  color: #fff; font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(47, 123, 255, .28);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 15px; }
.brand-text span { font-size: 11.5px; color: var(--muted); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-chip {
  background: var(--blue-soft); color: var(--blue-dark);
  padding: 5px 12px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
}
.btn-ghost {
  color: var(--muted); font-size: 13px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
}
.btn-ghost:hover { background: #f2f6fc; color: var(--blue); }

/* ------------------------------------------------ 布局 / 卡片 */
.container { max-width: 980px; margin: 0 auto; padding: 20px 18px 110px; }
.container-wide { max-width: 1180px; }
.section-gap { margin-bottom: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.card-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-title { font-size: 15.5px; font-weight: 700; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-row { padding: 10px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.inline-field { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.footer-note { color: #9aa6b5; font-size: 11.5px; text-align: center; padding: 18px 8px; line-height: 1.8; }

/* ------------------------------------------------ 表单控件 */
.input {
  border: 1px solid #dce4ee; border-radius: 9px; background: #fff;
  color: var(--text); padding: 8px 11px; font-size: 13px; outline: none;
  min-height: 36px; font-family: inherit;
}
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 123, 255, .12); }
.input:disabled { background: #f5f7fa; color: #a3adba; }
.select-compact { max-width: 180px; }
.search-input { width: 210px; }
.label { font-size: 12.5px; font-weight: 600; color: #46546a; margin: 0 0 7px; display: block; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #52617a; margin: 12px 0; cursor: pointer; }
.check-line input { accent-color: var(--blue); width: 15px; height: 15px; }

.btn {
  border: 1px solid transparent; border-radius: 9px; padding: 9px 16px;
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: .15s ease; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 3px 9px rgba(47, 123, 255, .22); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: #fff; color: var(--blue); border-color: #bcd3ff; }
.btn-secondary:hover { background: var(--blue-soft); }
.btn-soft { background: #f2f6fc; color: #4b5a70; border-color: #e4ebf5; }
.btn-soft:hover { background: #e8f0fc; color: var(--blue); }
.btn-danger { background: #fff1f1; color: var(--red); border-color: #ffd9da; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* ------------------------------------------------ 统计 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 16px 0; }
.stat {
  background: #f8fafd; border: 1px solid var(--line); border-radius: 11px;
  padding: 12px 14px; text-align: center;
}
.stat-num { font-size: 23px; font-weight: 700; line-height: 1.3; }
.stat-num.blue { color: var(--blue); }
.stat-num.green { color: var(--green); }
.stat-num.orange { color: var(--orange); }
.stat-label { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.progress-wrap { display: flex; align-items: center; gap: 12px; }
.progress { flex: 1; height: 8px; border-radius: 20px; background: #eef2f8; overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 20px; background: linear-gradient(90deg, #4b90ff, #17a35a); transition: width .35s ease; }

/* ------------------------------------------------ 班级选择 */
.class-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.class-chip {
  border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px;
  background: #fbfcfe; cursor: pointer; transition: .15s ease; text-align: left;
}
.class-chip:hover { border-color: #b8d0ff; background: #f5f9ff; }
.class-chip.active { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 2px rgba(47, 123, 255, .12); }
.class-chip strong { display: block; font-size: 14px; margin-bottom: 4px; }
.class-chip .chip-meta { font-size: 11.5px; color: var(--muted); }
.role-tag {
  display: inline-block; background: #eaf2ff; color: var(--blue-dark);
  border-radius: 5px; padding: 1px 6px; font-size: 11px; margin-right: 5px;
}
.tag { background: #f0f4fa; color: #6a788c; border-radius: 20px; padding: 3px 10px; font-size: 11.5px; white-space: nowrap; }
.tag-config { background: #fff5e8; color: #b26a12; }

/* ------------------------------------------------ 学生卡片 */
.student-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.student-card {
  position: relative; border: 1.5px solid var(--line); border-radius: 11px;
  padding: 12px 12px 10px; background: #fff; cursor: pointer;
  transition: .15s ease; min-height: 88px; user-select: none;
}
.student-card:hover { border-color: #b8d0ff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(47, 123, 255, .1); }
.student-card.signed { border-color: #b7e6cb; background: linear-gradient(180deg, #f4fdf7, #fff); }
.student-card.selected { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(47, 123, 255, .16); }
.student-check { position: absolute; top: 10px; right: 10px; width: 17px; height: 17px; accent-color: var(--blue); cursor: pointer; }
.student-name { font-size: 15px; font-weight: 650; margin: 2px 22px 8px 0; word-break: break-all; }
.status-badge { display: inline-block; font-size: 11.5px; font-weight: 600; border-radius: 6px; padding: 2px 8px; }
.status-badge.signed { background: var(--green-soft); color: var(--green); }
.status-badge.unsigned { background: var(--orange-soft); color: var(--orange); }
.student-meta { font-size: 10.5px; color: #9aa6b5; margin-top: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------ 批量操作条 */
.bulk-bar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 40;
  width: min(680px, calc(100% - 28px));
  background: #fff; border: 1px solid #d8e4f5; border-radius: 14px;
  box-shadow: 0 10px 30px rgba(28, 54, 93, .18); padding: 12px 16px;
}
.bulk-inner { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.bulk-inner strong { color: var(--blue); font-size: 16px; }

/* ------------------------------------------------ 表格 */
.table-wrap { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: 10px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
.data-table th {
  background: #f6f9fd; color: #5a687d; font-weight: 600; text-align: left;
  padding: 10px 12px; position: sticky; top: 0; z-index: 2; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid #f0f3f8; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafcff; }
.rate-cell { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.mini-progress { width: 74px; height: 6px; background: #eef2f8; border-radius: 8px; overflow: hidden; }
.mini-progress i { display: block; height: 100%; background: var(--green); border-radius: 8px; }
.pill { border-radius: 20px; padding: 2px 9px; font-size: 11.5px; font-weight: 600; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.orange { background: var(--orange-soft); color: var(--orange); }
.pill.gray { background: #f0f3f8; color: #7b8798; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 14px; font-size: 12.5px; color: var(--muted); }
.pager button { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 5px 11px; cursor: pointer; color: var(--blue); }
.pager button:disabled { color: #b4bdc9; cursor: not-allowed; }

/* ------------------------------------------------ Tabs */
.tabs { display: flex; gap: 6px; margin: 18px 0 14px; border-bottom: 1px solid var(--line); }
.tab {
  border: none; background: transparent; padding: 9px 18px; font-size: 13.5px;
  color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent;
  font-family: inherit; font-weight: 600;
}
.tab:hover { color: var(--blue); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.panel { display: block; }

/* ------------------------------------------------ 空状态 / 提示 */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty h3 { color: var(--text); font-size: 16px; margin: 10px 0 6px; }
.empty-icon {
  width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 50%;
  background: var(--blue-soft); color: var(--blue); font-size: 21px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.notice { background: #f7faff; border: 1px solid #e2ecff; border-radius: 10px; padding: 12px 14px; font-size: 12.5px; color: #52617a; line-height: 1.8; }
.error-banner { background: #fff1f1; border: 1px solid #ffd9da; color: #b9363e; border-radius: 9px; padding: 10px 13px; font-size: 12.5px; margin-bottom: 16px; }

/* ------------------------------------------------ 弹窗 / Toast */
.modal-mask { position: fixed; inset: 0; background: rgba(20, 32, 50, .42); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 15px; width: min(410px, 100%); padding: 22px; box-shadow: 0 18px 44px rgba(20, 32, 50, .22); }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.modal-body { font-size: 13px; color: #5a687d; line-height: 1.8; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.toast {
  position: fixed; left: 50%; top: 22px; transform: translate(-50%, -18px);
  background: #26344a; color: #fff; padding: 10px 18px; border-radius: 9px;
  font-size: 13px; z-index: 90; opacity: 0; pointer-events: none;
  transition: .22s ease; box-shadow: 0 8px 24px rgba(20, 32, 50, .2); max-width: 88vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #c93c44; }

/* ------------------------------------------------ 登录页 */
.login-page { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 40px; }
.login-card { width: min(430px, 100%); background: #fff; border-radius: 18px; box-shadow: 0 12px 40px rgba(28, 54, 93, .12); overflow: hidden; border: 1px solid var(--line); }
.login-hero {
  background: linear-gradient(135deg, #3d83ff 0%, #1f63e0 100%);
  color: #fff; padding: 30px 26px 26px; text-align: center;
}
.login-hero .brand-mark { margin: 0 auto 12px; background: rgba(255,255,255,.2); box-shadow: none; width: 42px; height: 42px; font-size: 19px; }
.login-hero h1 { font-size: 23px; margin: 0 0 6px; letter-spacing: 1px; }
.login-hero p { font-size: 12.5px; opacity: .86; margin: 0; }
.login-body { padding: 24px 24px 20px; }
.login-body .input { width: 100%; }
.dev-box { margin-top: 22px; border: 1px dashed #c9d8ef; border-radius: 12px; padding: 16px; background: #fafcff; }
.dev-title { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.login-footer { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11px; color: #9aa6b5; }
.status-dot.ok { color: var(--green); }
.status-dot.bad { color: var(--red); }

/* ------------------------------------------------ 家长端 */
.parent-child-card { margin-bottom: 14px; }
.parent-child-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.parent-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, #4b90ff, #1f63e0); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700;
}
.parent-child-name { font-size: 16px; font-weight: 700; }
.parent-class-list { display: grid; gap: 10px; }
.parent-class-row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfe;
}
.parent-class-name { font-weight: 600; color: #35435a; }
.parent-class-row .muted { grid-column: 1 / -1; }
.parent-status {
  align-self: center; padding: 4px 11px; border-radius: 20px;
  font-size: 12.5px; font-weight: 700;
}
.parent-status.signed { background: var(--green-soft); color: var(--green); }
.parent-status.unsigned { background: var(--orange-soft); color: var(--orange); }

/* ------------------------------------------------ 响应式 */
@media (max-width: 720px) {
  .header-inner { padding: 10px 14px; }
  .container { padding: 14px 12px 120px; }
  .card { padding: 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-num { font-size: 20px; }
  .student-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  .student-name { font-size: 14px; }
  .search-input { width: 100%; }
  .select-compact { max-width: none; }
  .toolbar-row > .btn, .toolbar-row > .input, .toolbar-row > .inline-field { flex: 1 1 130px; }
  .tabs { overflow-x: auto; }
  .tab { padding: 9px 13px; white-space: nowrap; }
  .table-wrap { max-height: 66vh; }
}
