:root {
  --primary: #0f6e56;
  --primary-dark: #0a5343;
  --primary-light: #e1f5ee;
  --danger: #a32d2d;
  --danger-light: #fcebeb;
  --warn-bg: #fdf6e3;
  --warn-border: #e5c96b;
  --ok-bg: #eaf3de;
  --ok-border: #97c459;
  --bg: #f4f7f5;
  --card: #ffffff;
  --border: #e2e8e5;
  --text: #22302b;
  --muted: #6b7a74;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

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

/* ── 顶栏 ─────────────────────────── */
.topbar { background: var(--primary); color: #fff; }
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand { font-size: 17px; font-weight: 500; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: #d9efe7; text-decoration: none; padding: 6px 12px; border-radius: 6px;
}
.nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.userbox { margin-left: auto; display: flex; gap: 12px; align-items: center; font-size: 13px; }
.userbox a { color: #d9efe7; text-decoration: none; }
.userbox a:hover { color: #fff; }
.who { opacity: .9; }

/* ── 布局 ─────────────────────────── */
.container { max-width: 1080px; margin: 20px auto 60px; padding: 0 16px; }
.container.center { max-width: 460px; margin-top: 8vh; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 6px 0 16px; flex-wrap: wrap;
}
h2 { font-size: 18px; font-weight: 500; margin: 0; }

/* ── 卡片 / 提示 ───────────────────── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.card-title { font-weight: 500; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-line { color: var(--muted); font-size: 14px; }
.card-actions { margin-top: 10px; display: flex; gap: 14px; align-items: center; }

.flash {
  background: var(--primary-light); border: 1px solid #9fe1cb;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px;
}
.flash-error { background: var(--danger-light); border-color: #f0b9b9; color: var(--danger); }

.banner {
  border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px;
  border: 1px solid var(--border); background: #eef2f0;
}
.banner-warn { background: var(--warn-bg); border-color: var(--warn-border); }
.banner-ok { background: var(--ok-bg); border-color: var(--ok-border); }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.empty-sm { color: var(--muted); font-size: 13px; padding: 6px 0; }
.muted { color: var(--muted); font-size: 13px; font-weight: 400; }

.tag {
  display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 20px;
  background: var(--primary-light); color: var(--primary); font-weight: 400;
}
.tag-ok { background: var(--ok-bg); color: #3b6d11; }

/* ── 表格 ─────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
  border-bottom: 1px solid var(--border); padding: 9px 10px; text-align: left;
  vertical-align: top;
}
.table th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.table tr:hover td { background: #fafcfb; }
.members { max-width: 420px; }
.actions { white-space: nowrap; }
.actions form, .inline { display: inline; margin: 0; }

.link {
  background: none; border: none; padding: 0; color: var(--primary);
  cursor: pointer; font-size: 14px; text-decoration: underline;
}
.link.danger { color: var(--danger); }

/* ── 按钮 / 表单 ───────────────────── */
.btn {
  display: inline-block; border: 1px solid var(--border); background: #fff;
  color: var(--text); border-radius: 8px; padding: 8px 16px; font-size: 14px;
  cursor: pointer; text-decoration: none; line-height: 1.5;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #7c1f1f; color: #fff; }
.btn-block { width: 100%; text-align: center; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.field { display: block; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.field input, .field select, .field textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 15px;
  color: var(--text); background: #fff; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary);
}
.form-card { max-width: 560px; }
.form-static { margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.hint { color: var(--muted); font-size: 14px; }

.filter-bar {
  display: flex; gap: 12px; align-items: end; margin-bottom: 16px; flex-wrap: wrap;
}
.batch-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 14px; margin-bottom: 12px;
}
.filter-bar label { font-size: 13px; color: var(--muted); }
.filter-bar select {
  margin-left: 6px; padding: 7px 9px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; background: #fff;
}

/* ── 报送页 ───────────────────────── */
.room-card .check-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px 12px;
}
.check-line {
  display: flex; align-items: center; gap: 8px; padding: 4px 2px; cursor: pointer;
}
.check-line input { width: 18px; height: 18px; accent-color: var(--primary); }
.btn-submit { margin-top: 6px; padding: 12px; font-size: 16px; }
.class-block .table { margin-top: 6px; }

/* ── 登录 ───────────────────────────
   页面底色用浅青绿，白色登录卡片配同色系描边轻浮起。 */
.login-page { background: #e1f5ee; }
.login-card {
  padding: 28px 26px;
  border: 1px solid #bfe3d6;
  box-shadow: 0 6px 18px rgba(15, 110, 86, .08);
}
/* 登录标题横幅：绿色菱形纹理平铺，与系统青绿主色一致 */
.login-banner {
  margin: -28px -26px 18px; padding: 12px 20px 10px; text-align: center;
  background-color: #2e7d32;
  background-image: url("bkground.jpg");
  background-repeat: repeat;
  background-size: auto;
  background-position: center;
  border-radius: var(--radius) var(--radius) 0 0;
}
.login-banner h1 {
  color: #fff; font-size: 24px; font-weight: 700; text-align: center;
  margin: 0 0 4px; text-shadow: 0 1px 4px rgba(0, 60, 0, .6);
}
.login-banner .sub { color: #fff; font-size: 12px; letter-spacing: .3px; margin: 0; }
/* 备案号（合规公示）：登录卡片底部小字 */
.login-card .beian { text-align: center; margin-top: 18px; font-size: 12px; color: var(--muted); }
.login-card .beian a { color: var(--muted); text-decoration: none; }
.login-card .beian a:hover { text-decoration: underline; }

/* ── 响应式：手机端 ─────────────────── */
.desktop-only { display: block; }
.mobile-only { display: none; }

@media (max-width: 720px) {
  body { font-size: 15px; }
  .desktop-only { display: none; }
  .mobile-only { display: block; }
  .topbar-inner { gap: 8px; padding: 8px 12px; }
  .brand { width: 100%; }
  .nav { order: 3; width: 100%; }
  .nav a { padding: 6px 10px; }
  .userbox { font-size: 12px; gap: 8px; }
  .container { margin: 14px auto 40px; padding: 0 10px; }
  .room-card .check-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar select { padding: 8px; }
  .btn { padding: 9px 14px; }
}

/* ── 排序链接与成员格（参照原型的一行一间布局） ───────── */
/* 排序链接与动作按钮必须同高同线：button 的 UA 样式会把 line-height 重置为
   normal（不继承正文），盒子变矮后在底对齐容器里文字整体下沉，故显式统一行高。 */
.sort-links { font-size: 13px; line-height: 20px; color: var(--muted); display: inline-flex; gap: 10px; align-items: center; }
.sort-link { color: var(--primary); text-decoration: underline; cursor: pointer; }
.sort-link.active { color: var(--primary-dark); font-weight: 600; text-decoration: none; }
.member-list { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.member-item { font-size: 14px; padding: 1px 0; }
.field small { display: block; margin-top: 4px; }

/* ── 统一表格样式：橙色线条（外框 2px / 内部 1px）+ 固定列宽，横向滑动查看 ──
   所有列表页（留宿名单、寝室信息、报送、用户、年级）共用。
   表格宽度由各列固定宽度之和决定，不随屏幕自适应；容器撑不下时横向滚动。 */
.table-frame {
  display: block;
  width: fit-content;
  max-width: 100%;
  border: 2px solid #e8871e;
  border-radius: 10px;
  background: #fff;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 14px;
}
.table.table-grid {
  width: auto;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 14px;
}
.table-grid th, .table-grid td {
  border: 1px solid #f5c184;              /* 内部橙线：比外框细一号 */
  text-align: center;
  vertical-align: middle;
  padding: 7px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-grid thead th { background: #fff5e9; color: #a85808; font-weight: 600; }
.table-grid tbody tr:hover td { background: #fffaf3; }
.table-grid td.actions { text-align: left; padding-left: 8px; }
.table-grid .check-line { display: flex; align-items: center; gap: 5px; padding: 2px 0; cursor: pointer; }
.table-grid .check-line input { width: 16px; height: 16px; flex: none; margin: 0; }
.table-grid .check-line span { overflow: hidden; text-overflow: ellipsis; }

/* 固定列宽：前几列内容长度确定，尽量收窄；成员一人一格 */
.table-grid col.c-check  { width: 34px; }
.table-grid col.c-grade  { width: 48px; }
.table-grid col.c-class  { width: 50px; }
.table-grid col.c-area   { width: 52px; }
.table-grid col.c-number { width: 62px; }
.table-grid col.c-floor  { width: 42px; }
.table-grid col.c-teacher { width: 76px; }
.table-grid col.c-member { width: 72px; }
.table-grid col.c-pick   { width: 80px; }
.table-grid col.c-op     { width: 78px; }
.table-grid col.c-user   { width: 110px; }
.table-grid col.c-role   { width: 84px; }
.table-grid col.c-num    { width: 58px; }
.table-grid col.c-wide   { width: 92px; }
.table-grid col.c-acts   { width: 152px; }

/* ── 留宿信息页：复制文字 / 保存图片 ─────────────────
   两个动作链接跟在「按班级」后面，用竖线跟排序组分开。 */
.bar-actions {
  display: inline-flex; gap: 12px; align-items: center;
  line-height: 20px;
  padding-left: 12px; border-left: 1px solid var(--border);
}
.act-link {
  background: none; border: none; padding: 0;
  font-family: inherit; font-size: 13px; line-height: 20px;
  color: var(--primary);
  cursor: pointer; text-decoration: underline;
}
.act-link:hover { color: var(--primary-dark); }
.act-link.done { color: #3b6d11; text-decoration: none; }

.pop-mask {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 50;
  background: rgba(20, 32, 28, .5); padding: 16px;
  display: flex; align-items: center; justify-content: center;
}
.pop-panel {
  background: #fff; border-radius: 12px; padding: 16px;
  width: 100%; max-width: 720px; max-height: 90vh; overflow: auto;
}
.pop-title { font-size: 15px; font-weight: 500; margin-bottom: 8px; }
.pop-hint { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.pop-img { display: block; width: 100%; border: 1px solid var(--border); border-radius: 8px; }
.pop-area {
  width: 100%; height: 96px; padding: 10px; font-size: 15px; font-family: inherit;
  color: var(--text); background: #fff; border: 1px solid var(--border); border-radius: 8px;
  resize: vertical;
}
.pop-acts { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
