:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e5e8ee;
  --brand: #2f6fed;
  --brand-ink: #ffffff;
  --ok: #1a9e56;
  --warn-bg: #fff7e6;
  --warn-line: #f0c36d;
  --err-bg: #fdecec;
  --err-line: #e5b4b4;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.6 -apple-system, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
.wrap { max-width: 640px; margin: 0 auto; padding: 12px 14px 0; }
header.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 10px 14px; display: flex; align-items: baseline; gap: 10px;
}
header.topbar .brand { font-size: 20px; font-weight: 700; letter-spacing: 2px; }
header.topbar .sub { color: var(--muted); font-size: 13px; }
header.topbar .spacer { flex: 1; }
h1 { font-size: 19px; margin: 14px 0 8px; }
h2 { font-size: 16px; margin: 14px 0 6px; }
.muted { color: var(--muted); font-size: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin: 10px 0;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; min-width: 48px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
  font-size: 16px; font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; margin: 10px 0; }
.btn-row .btn { flex: 1; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--ink);
  padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
textarea { min-height: 160px; resize: vertical; }
input[type="file"] { display: none; }
label.fld { display: block; margin: 10px 0; font-size: 14px; color: var(--muted); }
label.fld > :is(input, textarea, select) { margin-top: 4px; }
.seg { display: flex; gap: 8px; margin: 8px 0; }
.seg .btn { flex: 1; }
.seg .btn[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .chip {
  min-height: 40px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; font-size: 15px; cursor: pointer;
}
.chips .chip[aria-pressed="true"] { background: #e7efff; border-color: var(--brand); color: var(--brand); font-weight: 700; }
.preview { margin: 10px 0; }
.preview img { max-width: 100%; max-height: 260px; border-radius: 12px; border: 1px solid var(--line); display: block; }
.banner { border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-size: 15px; }
.banner.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); }
.banner.err { background: var(--err-bg); border: 1px solid var(--err-line); color: #8c2f2f; }
.banner.ok { background: #e9f7ef; border: 1px solid #bde5cc; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  flex: 1; min-height: 56px; border: 0; background: none; cursor: pointer;
  font-size: 14px; color: var(--muted); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
}
.tabs button[aria-current="page"] { color: var(--brand); font-weight: 700; }
.tabs .ico { font-size: 20px; line-height: 1; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #eef1f6; color: var(--muted); }
.badge.subject { background: #e7efff; color: var(--brand); }
.list-item { border-bottom: 1px solid var(--line); padding: 12px 2px; }
.list-item:last-child { border-bottom: 0; }
.stats { display: flex; gap: 8px; text-align: center; }
.stats .stat { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 4px; }
.stats .num { font-size: 22px; font-weight: 800; }
.stats .lab { font-size: 12px; color: var(--muted); }
.spinner {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-note { text-align: center; color: var(--muted); font-size: 14px; padding: 24px 12px; }
.login-body { padding-bottom: 0; display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-card { width: min(92vw, 380px); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 26px 22px; }
.login-card .brand { font-size: 30px; letter-spacing: 6px; text-align: center; margin: 0 0 2px; }
.login-card .muted { text-align: center; display: block; margin-bottom: 16px; }
.error { color: #b42318; font-size: 14px; text-align: center; }
.explain { background: #f2f6ff; border: 1px solid #d5e2fb; border-radius: 12px; padding: 10px 12px; margin: 8px 0; font-size: 15px; }
pre.text-block { white-space: pre-wrap; word-break: break-word; font: inherit; margin: 6px 0; }
