/* ============================================================
   勤工助学工时填报系统 · 校园简洁风格
   移动端优先 / 微信浏览器兼容 / 无任何外部字体与 CDN 依赖
   ============================================================ */

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff4ff;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --text-2: #4b5563;
  --muted: #8b95a5;
  --line: #e8ecf3;
  --ok: #0f9d6e;
  --ok-soft: #e6f7f1;
  --warn: #d98016;
  --warn-soft: #fff5e6;
  --danger: #dc3545;
  --danger-soft: #fdecee;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(31, 45, 78, .06);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100vh; }

a { color: var(--brand); text-decoration: none; }

.wrap { max-width: 560px; margin: 0 auto; padding: 0 14px; }

/* ---------------- 顶部栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(135deg, #2563eb, #4f7df3);
  color: #fff;
  padding: 14px 16px calc(14px + 6px);
  box-shadow: 0 2px 10px rgba(37, 99, 235, .22);
}
.topbar .tb-inner { max-width: 560px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.topbar h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: .5px; }
.topbar .sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.topbar .tb-btn {
  background: rgba(255, 255, 255, .18); color: #fff; border: 0;
  padding: 6px 12px; border-radius: 20px; font-size: 12.5px;
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 14px 0;
}
.card-t {
  font-size: 15px; font-weight: 600; margin: 0 0 12px;
  display: flex; align-items: center; gap: 7px;
}
.card-t::before {
  content: ''; width: 3px; height: 15px; border-radius: 2px; background: var(--brand); display: inline-block;
}
.card-tip { font-size: 12.5px; color: var(--muted); margin: -6px 0 12px; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field .req { color: var(--danger); }

input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfe;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b95a5' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); background: #fff; }

.row2 { display: flex; gap: 10px; }
.row2 > * { flex: 1; min-width: 0; }
.inline-unit { display: flex; align-items: center; gap: 6px; }
.inline-unit span { font-size: 14px; color: var(--text-2); flex: none; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border: 0; border-radius: 10px; padding: 11px 16px;
  font-size: 15px; font-family: inherit; font-weight: 500;
  background: var(--brand); color: #fff;
  cursor: pointer; transition: opacity .15s;
}
.btn:active { opacity: .82; }
.btn[disabled] { background: #b9c4d6; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 18px; font-size: 16px; }
.btn-ghost { background: var(--brand-soft); color: var(--brand-dark); }
.btn-line { background: #fff; color: var(--text-2); border: 1px solid var(--line); }
.btn-ok { background: var(--ok); }
.btn-warn { background: var(--warn); }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- 徽标 / 标签 ---------------- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; line-height: 1.7; font-weight: 500; white-space: nowrap;
}
.b-pending { background: var(--warn-soft); color: var(--warn); }
.b-approved { background: var(--ok-soft); color: var(--ok); }
.b-merged { background: #eef0f4; color: #6b7280; }
.b-info { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------------- 列表项 ---------------- */
.item {
  background: #fff; border-radius: 12px; padding: 13px 14px;
  margin-bottom: 10px; box-shadow: var(--shadow);
  border-left: 3px solid transparent;
}
.item.pending { border-left-color: var(--warn); }
.item.approved { border-left-color: var(--ok); }
.item.merged { border-left-color: #c9cfda; }
.item-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.item-name { font-weight: 600; font-size: 14.5px; }
.item-no { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 5px; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 7px; font-size: 13px; color: var(--text-2); }
.item-meta b { color: var(--brand-dark); font-weight: 600; }
.item-remark {
  margin-top: 8px; font-size: 13px; color: var(--text-2);
  background: #f7f9fc; border-radius: 8px; padding: 7px 10px; word-break: break-all;
}
.item-foot { margin-top: 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.item-time { font-size: 11.5px; color: var(--muted); }

/* ---------------- 统计小卡 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-grid.c3 { grid-template-columns: repeat(3, 1fr); }
.stat {
  background: #fff; border-radius: 12px; padding: 12px; text-align: center; box-shadow: var(--shadow);
}
.stat .v { font-size: 19px; font-weight: 700; color: var(--brand-dark); }
.stat .k { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------------- 表格 ---------------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
th, td { padding: 9px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { background: #f7f9fc; color: var(--text-2); font-weight: 600; font-size: 12.5px; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.money { color: #c92a2a; font-weight: 600; }

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--line);
  display: flex;
  padding-bottom: var(--safe-b);
  backdrop-filter: saturate(180%) blur(8px);
}
.tabbar a {
  flex: 1; text-align: center; padding: 8px 0 7px;
  color: var(--muted); font-size: 11.5px; border: 0; background: none;
  font-family: inherit;
}
.tabbar a .ic { display: block; font-size: 19px; line-height: 1.25; }
.tabbar a.on { color: var(--brand); font-weight: 600; }
.page-pad { padding-bottom: calc(70px + var(--safe-b)); }

/* ---------------- 顶部选项卡 ---------------- */
.seg {
  display: flex; background: #eaeff8; border-radius: 10px; padding: 3px; margin: 14px 0;
}
.seg button {
  flex: 1; border: 0; background: none; padding: 8px 4px; border-radius: 8px;
  font-size: 14px; color: var(--text-2); font-family: inherit;
}
.seg button.on { background: #fff; color: var(--brand-dark); font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, .06); }

/* ---------------- 时间段卡片（学生填报） ---------------- */
.tslot {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 12px 14px;
  margin: 12px 0; background: #fbfcff;
}
.ts-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ts-no { font-size: 14px; font-weight: 600; color: var(--brand-dark); }
.ts-del {
  border: 0; background: #fde8e8; color: #c0392b; width: 26px; height: 26px;
  border-radius: 50%; font-size: 14px; line-height: 1; cursor: pointer;
}

/* 快捷时间段按钮 */
.quick-times {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 8px;
}
.qt-btn {
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  padding: 7px 6px; border-radius: 8px; font-size: 12.5px; font-family: inherit;
  cursor: pointer; transition: all .15s;
}
.qt-btn:active {
  background: var(--brand); border-color: var(--brand); color: #fff;
}

.chips { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 8px; -webkit-overflow-scrolling: touch; }
.chips button {
  flex: none; border: 1px solid var(--line); background: #fff; color: var(--text-2);
  padding: 6px 13px; border-radius: 20px; font-size: 13px; font-family: inherit;
}
.chips button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------------- 空状态 / 加载 ---------------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 13.5px; }
.empty .ic { font-size: 34px; display: block; margin-bottom: 8px; opacity: .5; }
.loadmore { text-align: center; padding: 12px; color: var(--muted); font-size: 13px; }

.mask {
  position: fixed; inset: 0; background: rgba(20, 26, 40, .45); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.mask.center { align-items: center; }
.sheet {
  background: #fff; width: 100%; max-width: 560px;
  border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + var(--safe-b));
  max-height: 88vh; overflow-y: auto;
}
.mask.center .sheet { border-radius: 14px; margin: 0 16px; max-width: 420px; }
.sheet-t { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.sheet-sub { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; }

.toast {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%);
  background: rgba(28, 33, 48, .92); color: #fff; padding: 11px 18px;
  border-radius: 10px; font-size: 14px; z-index: 200; max-width: 78%;
  text-align: center; line-height: 1.5;
}
.spin {
  position: fixed; inset: 0; z-index: 150; background: rgba(255, 255, 255, .55);
  display: flex; align-items: center; justify-content: center;
}
.spin i {
  width: 26px; height: 26px; border: 3px solid #cfdaf0; border-top-color: var(--brand);
  border-radius: 50%; display: block; animation: sp .7s linear infinite;
}
@keyframes sp { to { transform: rotate(360deg); } }

.notice {
  background: var(--brand-soft); color: var(--brand-dark); border-radius: 10px;
  padding: 10px 12px; font-size: 12.5px; line-height: 1.65; margin: 12px 0;
}
.notice.warn { background: var(--warn-soft); color: #9a5b0c; }
.notice.danger { background: var(--danger-soft); color: #a91f2c; }

.hr { height: 1px; background: var(--line); margin: 14px 0; border: 0; }
.muted { color: var(--muted); font-size: 12.5px; }
.right { text-align: right; }
.mt8 { margin-top: 8px; } .mt14 { margin-top: 14px; }
.hide { display: none !important; }

.chk { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.chk input { width: 17px; height: 17px; accent-color: var(--brand); }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px 0; }
.pager button { border: 1px solid var(--line); background: #fff; color: var(--text-2); border-radius: 8px; padding: 6px 14px; font-family: inherit; font-size: 13px; }
.pager button[disabled] { opacity: .45; }
.pager span { font-size: 13px; color: var(--muted); }

.footer { text-align: center; color: var(--muted); font-size: 11.5px; padding: 18px 0 26px; }
