/* ============================================================
   基础排版与容器（移动优先）
   沿用站点现有的 reset.css，此文件补充正文字体/颜色与通用组件。
   index.html 之外的新页面（login / register / admin）都引用本文件。
   ============================================================ */

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #2b2b2b;
  background-color: #fafafa;
  overflow-x: hidden; /* 兼容旧 index.css 的 overflow 规则 */
}

a {
  color: #2760a8;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}

h2 {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
}

/* ---------------- 顶部标题区 ---------------- */

.site-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.9rem 1rem;
  background-color: rgb(231, 231, 231);
}

.site-head .site-logo {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}

.site-head .site-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.site-head .spacer {
  flex: 1 1 auto;
}

/* ---------------- 认证状态条 ---------------- */

#auth-bar {
  display: flex;
  flex-wrap: wrap; /* 窄屏自动换行，不被挤出视口 */
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem 0.9rem;
  font-size: 0.85rem;
  color: #55606b;
}

#auth-bar .auth-greeting {
  font-weight: 600;
  color: #2b2b2b;
}

#auth-bar a,
#auth-bar button {
  font-size: 0.85rem;
  color: #2760a8;
  background: none;
  border: 0;
  padding: 0.35rem 0; /* 触控面积 */
  cursor: pointer;
  font-family: inherit;
}

#auth-bar button:hover,
#auth-bar a:hover {
  text-decoration: underline;
}

#auth-bar .auth-loading {
  color: #9aa4ad;
}

/* 「我的作业」后面的待交数量红点 */
#auth-bar .auth-dot {
  display: inline-block;
  min-width: 1.15rem;
  padding: 0 0.28rem;
  margin-left: 0.3rem;
  border-radius: 999px;
  background: #2760a8;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
  vertical-align: 1px;
}

#auth-bar .auth-dot-over {
  background: #c0392b;
}

/* ---------------- 卡片 ---------------- */

.panel {
  width: calc(100% - 2rem); /* 窄屏留出安全边距，避免被 100% + padding 撑出横向滚动 */
  max-width: 27rem;
  margin: 1.25rem auto;
  padding: 1.25rem;
  background: #fff;
  border: 1px solid #e3e6ea;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

@media (min-width: 30rem) {
  .panel {
    width: 100%;
  }
}

/* ---------------- 表单 ---------------- */

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #3c4650;
}

.field .hint {
  font-size: 0.78rem;
  color: #8b959e;
  font-weight: 400;
  margin-left: 0.35rem;
}

.input,
select.input,
textarea.input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-size: 1rem; /* ≥16px 防止 iOS 聚焦时自动放大 */
  font-family: inherit;
  color: #2b2b2b;
  padding: 0.65rem 0.7rem; /* 足够触控面积 */
  border: 1px solid #ccd2d9;
  border-radius: 6px;
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
}

select.input {
  background-image: linear-gradient(45deg, transparent 50%, #6b7681 50%),
    linear-gradient(135deg, #6b7681 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(1em + 2px), calc(100% - 13px) calc(1em + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

.input:focus {
  outline: none;
  border-color: #2760a8;
  box-shadow: 0 0 0 3px rgba(39, 96, 168, 0.13);
}

.input:disabled {
  background: #f2f4f6;
  color: #8b959e;
}

textarea.input {
  min-height: 4.5rem;
  resize: vertical;
  line-height: 1.5;
}

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  min-height: 2.75rem; /* 触控友好 */
  padding: 0.6rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #2760a8;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: #1f508e;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-secondary {
  background: #fff;
  color: #2760a8;
  border-color: #b9c6d6;
}

.btn-secondary:hover {
  background: #f0f5fb;
}

.btn-danger {
  background: #c0392b;
}

.btn-danger:hover {
  background: #a53125;
}

.btn-sm {
  font-size: 0.82rem;
  min-height: 2rem;
  padding: 0.3rem 0.6rem;
  font-weight: 500;
}

/* ---------------- 提示消息 ---------------- */

.msg {
  display: none;
  margin-bottom: 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
  border: 1px solid transparent;
}

.msg.show {
  display: block;
}

.msg-error {
  background: #fdecea;
  border-color: #f5c6c0;
  color: #a53125;
}

.msg-ok {
  background: #eaf6ec;
  border-color: #bfe0c6;
  color: #26663a;
}

.msg-info {
  background: #eef4fb;
  border-color: #c8dbf1;
  color: #24507f;
}

/* ---------------- 页脚（改为常规流式，窄屏不再重叠） ---------------- */

.site-footer {
  margin-top: 2rem;
  padding: 1rem;
  text-align: center;
  color: #979797;
  font-size: 0.82rem;
}

/* ---------------- 表格（窄屏可横向滚动） ---------------- */

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e3e6ea;
  border-radius: 8px;
  background: #fff;
}

table.data {
  border-collapse: collapse;
  width: 100%;
  min-width: 46rem;
  font-size: 0.875rem;
}

table.data th,
table.data td {
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid #eceff2;
  white-space: nowrap;
}

table.data th {
  background: #f6f8fa;
  font-weight: 700;
  color: #3c4650;
  position: sticky;
  top: 0;
  z-index: 1;
}

table.data tbody tr:hover {
  background: #fafcff;
}

table.data td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------------- 小工具类 ---------------- */

.muted {
  color: #8b959e;
}

.small {
  font-size: 0.82rem;
}

.center {
  text-align: center;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.nowrap {
  white-space: nowrap;
}

.hidden {
  display: none !important;
}
