:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #e3e6ea;
  --text: #1c2024;
  --muted: #6b7280;
  --brand: #1a6fe0;
  --brand-weak: #eaf1fc;
  --danger: #c0392b;
  --ok: #1e7f4f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* 顶栏 */
.topbar {
  height: 58px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-size: 17px; font-weight: 700; letter-spacing: 0.5px; }
.brand::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--brand);
  margin-right: 8px;
  vertical-align: 2px;
}
.who { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.who .name { color: var(--text); font-weight: 600; }
.chip {
  background: var(--brand-weak);
  color: var(--brand);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}
.link { color: var(--muted); text-decoration: none; }
.link:hover { color: var(--brand); }
.inline { display: inline; margin: 0; }

/* 布局 */
.wrap { max-width: 960px; margin: 0 auto; padding: 28px 20px 60px; }
.pagehead { margin-bottom: 18px; }
.pagehead h1 { font-size: 22px; margin: 0 0 4px; }
.sub { color: var(--muted); font-size: 14px; margin: 0; }

/* 登录 */
.login-box {
  max-width: 380px;
  margin: 8vh auto 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px 28px 26px;
  box-shadow: 0 6px 24px rgba(20, 30, 50, 0.05);
}
.login-box h1 { font-size: 24px; margin: 0 0 6px; text-align: center; }
.login-box .sub { text-align: center; margin-bottom: 22px; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form.narrow { max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.form input {
  height: 44px;
  padding: 0 12px;
  font-size: 16px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  outline: none;
}
.form input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }

.btn {
  display: inline-block;
  height: 44px;
  line-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: #155fc4; }
.btn-ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: #c9cfd6; }

.alert {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid #f5c6c0;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 14px;
}
.ok {
  background: #e9f7ef;
  color: var(--ok);
  border: 1px solid #bfe6cf;
  border-radius: 9px;
  padding: 12px;
  font-size: 15px;
}
.ok a { color: var(--ok); font-weight: 600; }

.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 18px 0 0; }

/* 表格 */
.tablewrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--line); }
th { background: #fafbfc; font-size: 13px; color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
td.strong { font-weight: 600; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.tag-a { background: #eaf1fc; color: #1a6fe0; }
.tag-b { background: #eef7ee; color: #2f7d3a; }
.tag-x { background: #f1f2f4; color: #6b7280; }

/* 卡片 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card, .bigcard {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
.bigcard { max-width: 520px; }
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cname { font-size: 19px; font-weight: 700; }
.bigcard .cname { font-size: 24px; margin-bottom: 14px; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.rows > div { display: flex; justify-content: space-between; font-size: 15px; }
.rows span { color: var(--muted); }
.rows b { font-weight: 600; }

.empty {
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 34px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

.note {
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
}
.note p { margin: 4px 0; }

.msgbox {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 34px;
  text-align: center;
  max-width: 480px;
  margin: 6vh auto;
}
.msgbox h1 { font-size: 20px; margin: 0 0 8px; }
.msgbox p { color: var(--muted); margin: 0 0 18px; }

/* 工具条与筛选 */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.filters input[type="search"],
.filters select {
  height: 38px;
  padding: 0 10px;
  font-size: 14px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  outline: none;
}
.filters input[type="search"] { width: 200px; }
.filters input:focus, .filters select:focus { border-color: var(--brand); }
.btn.small { height: 38px; line-height: 38px; font-size: 14px; padding: 0 14px; }

/* 表单卡片 */
.card-form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  max-width: 720px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form select,
.form textarea {
  padding: 0 12px;
  font-size: 16px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  outline: none;
  font-family: inherit;
}
.form select { height: 44px; }
.form textarea { padding: 10px 12px; line-height: 1.6; resize: vertical; }
.form select:focus, .form textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }
.req { color: var(--danger); font-weight: 400; }
.actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.btn-ghost.big { height: 44px; line-height: 42px; padding: 0 16px; font-size: 15px; text-decoration: none; display: inline-block; }

/* 归档 */
.archive-form {
  max-width: 720px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-danger {
  border: 1px solid #e6b3ac;
  background: #fff;
  color: var(--danger);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}
.btn-danger:hover { background: #fdecea; }
.hint-inline { color: var(--muted); font-size: 13px; }

.col-act { text-align: right; width: 80px; }
.ok { margin-bottom: 14px; }

/* 当场开家长账号 */
.new-parent {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fafbfc;
}
.new-parent summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--brand);
  outline: none;
}
.new-parent[open] summary { margin-bottom: 12px; }
.new-parent .hint-inline { margin: 8px 0 0; display: block; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* 教材三格 */
.textbook-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #fafbfc;
}
.tb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.tb-title { font-size: 14px; color: var(--muted); }
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.inline-check input { width: auto; height: auto; margin: 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.textbook-cell { font-size: 12px; line-height: 1.5; color: #4b5563; }

/* 错题 */
.muted { color: var(--muted); }
.col-date { width: 96px; }
.col-subj { width: 60px; }
.qline { max-width: 460px; }
.file-input { padding: 8px 0; font-size: 14px; }

.mistake-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 20px;
}
.photo-box { margin-bottom: 14px; }
.photo-box img {
  max-width: 100%;
  max-height: 420px;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: block;
}
.qtext {
  font-size: 16px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 12px;
}

.kp-ask {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}
.kp-ask h2 { font-size: 17px; margin: 0 0 6px; }
.kp-list { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.kp-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  background: #fff;
}
.kp-option:hover { border-color: #c9d6ea; background: #fafcff; }
.kp-option input { margin-top: 4px; }
.kp-body { flex: 1; }
.kp-name { font-size: 15px; font-weight: 600; line-height: 1.5; }
.kp-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kp-hits { font-size: 12px; color: var(--ok); margin-top: 4px; }
.kp-hits.muted { color: var(--muted); }

.kp-done {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ok);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
.kp-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.kp-pool { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 14px; }
.kp-pool summary { cursor: pointer; color: var(--brand); font-size: 14px; }
.kp-filter {
  width: 100%;
  height: 40px;
  margin: 12px 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
.kp-pool-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.kp-pool-row { margin: 0; border-bottom: 1px solid var(--line); }
.kp-pool-row:last-child { border-bottom: 0; }
.kp-pool-btn {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 0;
  padding: 10px 12px;
  cursor: pointer;
  display: block;
  font-family: inherit;
}
.kp-pool-btn:hover { background: #f7f9fc; }
.kp-pool-btn .kp-name { font-weight: 500; font-size: 14px; }
.kp-pool-btn .kp-meta { display: block; }

.sep { color: #c7ccd2; margin: 0 4px; }

.ai-note {
  background: #f2f7ff;
  border: 1px solid #d6e4fa;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  margin: 8px 0 4px;
}

.weak-card .cname.small { font-size: 16px; line-height: 1.5; }
.count-badge {
  flex: none;
  background: #fdecea;
  color: var(--danger);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.card-link {
  display: block;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--brand);
  font-size: 14px;
  text-decoration: none;
}
.card-link:hover { text-decoration: underline; }

.qtag {
  display: inline-block;
  background: #f2f7ff;
  color: var(--brand);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  margin: 6px 0;
}

.foot {
  text-align: center;
  color: #9aa2ac;
  font-size: 12px;
  padding: 20px 0 28px;
}

@media (max-width: 560px) {
  .wrap { padding: 18px 14px 40px; }
  .hide-sm { display: none; }
  .login-box { margin-top: 4vh; padding: 26px 20px; }
  .grid2 { grid-template-columns: 1fr; }
  .filters input[type="search"] { width: 100%; }
  .toolbar { align-items: stretch; }
  .toolbar .btn { text-align: center; }
}
