:root {
  --bg: #F5F6F8;
  --card: #ffffff;
  --line: #EBEEF2;
  --line2: #E5E7EB;
  --text: #111827;
  --label: #374151;
  --muted: #6B7280;
  --ph: #9CA3AF;
  --brand: #2563EB;
  --brand-h: #1D4ED8;
  --brand-soft: #EFF6FF;
  --danger: #EF4444;
  --ok: #067647;
  --warn: #B54708;
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}

#app { max-width: 1340px; margin: 0 auto; padding: 26px 24px 64px; }

h1 { font-size: 20px; font-weight: 700; margin: 0; }
h2 { font-size: 18px; font-weight: 700; margin: 0 0 20px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 10px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

/* ---------- 顶部标题栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  min-height: 78px; padding: 14px 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.topbar .grow { flex: 1; min-width: 0; }
.topbar h1 { color: var(--brand); display: flex; align-items: center; gap: 8px; }
.topbar h1 .ico { font-size: 22px; line-height: 1; }
.topbar .who { font-size: 13px; color: var(--muted); margin-top: 2px; }
.topbar .navs { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
button {
  font: inherit; font-size: 15px; cursor: pointer;
  border-radius: 8px; border: 1px solid var(--line2);
  background: #fff; color: var(--label);
  height: 40px; padding: 0 16px;
  transition: background .12s, border-color .12s, color .12s;
}
button:hover { background: #F9FAFB; }
button.on, button.primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
button.on:hover, button.primary:hover { background: var(--brand-h); border-color: var(--brand-h); }
button.ghost { background: transparent; }
button.danger { color: var(--danger); border-color: #FBD5D5; }
button.danger:hover { background: #FEF2F2; }
button.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 7px; }
button:disabled { opacity: .55; cursor: not-allowed; }

.btn-confirm { height: 42px; padding: 0 24px; }

/* ---------- 表单 ---------- */
label.lbl {
  display: block; font-size: 14px; color: var(--label);
  margin: 0 0 8px;
}
label.lbl .req { color: var(--danger); margin-left: 4px; }

input[type=text], input[type=password], input[type=number],
input[type=datetime-local], textarea, select {
  width: 100%; height: 44px; padding: 0 12px;
  font: inherit; font-size: 15px; color: var(--text);
  background: #fff; border: 1px solid var(--line2); border-radius: 8px;
  outline: none;
}
textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.55; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ph); }
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

select.focus-blue { border-color: var(--brand); }
select.empty { color: var(--ph); }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- 手机适配（< 720px） ---------- */
@media (max-width: 719px) {
  #app { padding: 14px 12px 56px; }

  .card { padding: 16px; margin-bottom: 12px; }
  h2 { font-size: 16px; margin-bottom: 14px; }

  /* 标题栏：标题占满一行，三个按钮收到第二行等分 */
  .topbar { padding: 12px 16px; min-height: 0; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
  .topbar h1 { font-size: 17px; gap: 6px; }
  .topbar h1 .ico { font-size: 18px; }
  .topbar .navs { width: 100%; gap: 8px; }
  .topbar .navs button { flex: 1; min-width: 0; height: 36px; padding: 0 6px; font-size: 14px; }

  /* 身份区两列改单列 */
  .field-grid { grid-template-columns: 1fr; gap: 12px; }

  /* 输入框字号 16px，否则 iOS 聚焦时会把整页放大 */
  input[type=text], input[type=password], input[type=number],
  input[type=datetime-local], textarea, select { font-size: 16px; }

  .hint { font-size: 13px; }
  .btn-confirm { width: 100%; }

  /* 上传区竖排，按钮占满一行 */
  .filebox { flex-direction: column; align-items: stretch; gap: 8px; }
  .filebox button { width: 100%; height: 40px; }

  .tabs { gap: 6px; }
  .tabs button { flex: 1; height: 36px; padding: 0 8px; font-size: 13px; }

  .row > .grow { flex-basis: 100%; }
  .spacer { display: none; }

  .sheet { padding: 16px; max-height: 94vh; }
  #toast { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  #toast div { font-size: 13px; padding: 8px 14px; }

  .ass-head h3 { font-size: 15px; }
  table { font-size: 13px; }
  th, td { padding: 8px 8px; }
}

.hint { font-size: 14px; color: var(--muted); margin: 12px 0 0; }
.hint-top { margin-bottom: 16px; }

/* ---------- 其它 ---------- */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }

.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.pre { white-space: pre-wrap; word-break: break-word; }

.tag {
  display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: #F3F4F6; color: var(--muted); white-space: nowrap;
}
.tag.ok { background: #E7F6EE; color: var(--ok); }
.tag.warn { background: #FEF3E6; color: var(--warn); }
.tag.bad { background: #FDECEC; color: var(--danger); }
.tag.blue { background: var(--brand-soft); color: var(--brand); }

.tablewrap { overflow-x: auto; border: 1px solid var(--line2); border-radius: 10px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #FAFBFC; }
tr.click:hover { background: #F8FAFC; cursor: pointer; }
tbody tr:last-child td { border-bottom: none; }

.empty { text-align: center; color: var(--muted); padding: 28px 10px; font-size: 14px; }

/* 作业卡片内部 */
.ass { border-top: 1px solid var(--line2); padding-top: 18px; margin-top: 18px; }
.ass:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.ass-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ass-head h3 { font-size: 16px; font-weight: 700; margin: 0; }
.ass-body { margin: 10px 0; color: #333; }
.filebox {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  border: 1px dashed var(--line2); border-radius: 10px; padding: 12px; background: #FBFCFD;
}
.filebox input[type=file] { flex: 1; min-width: 180px; font-size: 14px; }
.mine-box { margin-top: 10px; background: #F8FAFC; border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; }

/* 记录列表 */
.rec { border-bottom: 1px solid var(--line2); padding: 14px 0; }
.rec:last-child { border-bottom: none; padding-bottom: 0; }
.rec:first-child { padding-top: 0; }

/* toast / sheet */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
#toast div {
  background: #111827; color: #fff; padding: 9px 16px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.18); animation: pop .18s ease-out;
}
#toast div.bad { background: #B42318; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.42);
  display: flex; align-items: flex-end; justify-content: center; z-index: 80;
}
@media (min-width: 720px) { .mask { align-items: center; } }
.sheet {
  background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 20px;
}
@media (min-width: 720px) { .sheet { border-radius: 16px; } }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { height: 38px; border-radius: 999px; padding: 0 16px; font-size: 14px; }

a { color: var(--brand); }
