﻿:root {
  --bg: #f2f5fb;
  --card: #ffffff;
  --ink: #171d2b;
  --ink-2: #4a5670;
  --muted: #8894ab;
  --line: #e6eaf3;
  --accent: #3b6ef6;
  --accent-soft: #eaf0ff;
  --free: #0ca678;
  --free-soft: #e7f8f1;
  --leave: #f08c00;
  --leave-soft: #fff4e2;
  --danger: #e5484d;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(23, 29, 43, .04), 0 8px 24px rgba(23, 29, 43, .05);
  --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(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { overscroll-behavior-y: contain; }

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(76px + var(--safe-b));
  background: var(--bg);
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* ------------------------------------------------------------ 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 12px;
  background: linear-gradient(180deg, #f7f9fe 60%, rgba(247, 249, 254, .82));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(230, 234, 243, .7);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand .logo {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  box-shadow: 0 6px 14px rgba(59, 110, 246, .28);
}

.brand h1 { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.brand p { font-size: 11.5px; color: var(--muted); }

.week-chip {
  flex: none;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ------------------------------------------------------------ 日期条 */
.daystrip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 12px 16px 6px;
}

.daycell {
  padding: 7px 0 6px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  text-align: center;
  transition: .16s;
  min-width: 0;
}
.daycell b { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.daycell span { display: block; font-size: 17px; font-weight: 700; margin-top: 1px; }
.daycell em { display: block; font-size: 10px; color: var(--muted); font-style: normal; margin-top: 1px; }
.daycell.is-today b { color: var(--accent); }
.daycell.active { background: var(--accent); border-color: var(--accent); box-shadow: 0 8px 18px rgba(59, 110, 246, .28); }
.daycell.active b, .daycell.active span, .daycell.active em { color: #fff; }
.daycell.dim span { color: #b9c2d4; }

.daybar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 16px 8px;
}
.daybar .navbtn {
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-2);
}
.daybar .datetext { font-size: 13px; color: var(--ink-2); font-weight: 600; }

/* ------------------------------------------------------------ 通用卡片 */
.main { padding: 4px 16px 20px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 6px 0 14px;
}
.stat {
  background: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); }
.stat.accent b { color: var(--accent); }
.stat.leave b { color: var(--leave); }

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 2px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.section-title .hint { font-weight: 400; color: var(--muted); font-size: 11.5px; }

/* ------------------------------------------------------------ 空闲卡片 */
.slot {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 13px 10px;
  margin-bottom: 10px;
  border: 1px solid transparent;
}
.slot.now { border-color: #c9d9ff; background: linear-gradient(180deg, #fff, #f7faff); }

.slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.slot-when { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.slot-when b { font-size: 15px; }
.slot-when span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.badge-now {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}
.slot-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.slot-count b { color: var(--free); font-size: 15px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px 5px 5px;
  border-radius: 999px;
  background: #f6f8fd;
  border: 1px solid #eaeef8;
  font-size: 13px;
  transition: .15s;
  max-width: 100%;
}
.chip:active { transform: scale(.97); }
.chip .av {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  flex: none;
}
.chip .nm { white-space: nowrap; }

.chip.leave { background: var(--leave-soft); border-color: #ffe3b0; }
.chip.leave .nm { color: #8a5400; }
.chip.pending { background: #fff; border-style: dashed; border-color: #f5c778; }

.tag {
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  white-space: nowrap;
}
.tag.leave { background: var(--leave); color: #fff; }
.tag.pending { background: #ffe9c2; color: #8a5400; }
.tag.monitor { background: #e8edff; color: #3b5bcc; }

.empty-line { font-size: 12.5px; color: var(--muted); padding: 2px 4px 4px; }

details.busy { margin-top: 9px; border-top: 1px dashed var(--line); padding-top: 7px; }
details.busy summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
details.busy summary::-webkit-details-marker { display: none; }
details.busy summary::after { content: "▾"; font-size: 10px; transition: .2s; }
details.busy[open] summary::after { transform: rotate(180deg); }
.busy-list { margin-top: 7px; display: grid; gap: 5px; }
.busy-row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.busy-row .course { color: var(--ink); font-weight: 500; }
.busy-row .where { color: var(--muted); }
.busy-row .tm { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }

/* ------------------------------------------------------------ 表单 */
.field { margin-bottom: 12px; }
.field > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.input, .textarea, .select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fbfcff;
  outline: none;
  transition: .15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: #b9cbff; background: #fff; box-shadow: 0 0 0 3px rgba(59, 110, 246, .1); }
.textarea { min-height: 84px; resize: vertical; }

.slotpick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.slotpick button {
  padding: 8px 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fbfcff;
  font-size: 12.5px;
  color: var(--ink-2);
}
.slotpick button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.slotpick button.free { border-color: #bfe8d8; background: #f1fbf6; color: #0a7f5f; }

/* 时段分隔（上午 / 下午 / 晚上） */
.period {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 2px 8px;
}
.period span {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  letter-spacing: .5px;
}
.period i { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

.nextbar {
  background: linear-gradient(120deg, #2f5fe8, #4a7dff);
  color: #fff;
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 12.5px;
  margin-bottom: 12px;
  box-shadow: 0 10px 22px rgba(59, 110, 246, .25);
}
.nextbar b { font-size: 15px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 8px 18px rgba(59, 110, 246, .22);
}
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; color: var(--ink-2); border: 1px solid var(--line); box-shadow: none; }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid #ffd7d8; box-shadow: none; }
.btn.small { padding: 8px 12px; font-size: 12.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1 1 0; min-width: 0; }
.row.tight > * { flex: none; }

/* ------------------------------------------------------------ 周课表 */
.gridwrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); background: #fff; }
table.grid { border-collapse: collapse; width: 100%; font-size: 10.5px; table-layout: fixed; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 5px 2px; text-align: center; vertical-align: top; }
table.grid thead th {
  position: sticky;
  top: 0;
  background: #fbfcff;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
  padding: 7px 2px;
  z-index: 2;
}
table.grid thead th.today { color: var(--accent); }
table.grid th.slotcol, table.grid td.slotcol {
  position: sticky;
  left: 0;
  background: #fbfcff;
  width: 52px;
  z-index: 1;
  border-right: 1px solid var(--line);
}
table.grid td.slotcol { font-size: 9.5px; line-height: 1.25; color: var(--muted); }
table.grid td.slotcol b { display: block; color: var(--ink-2); font-size: 11px; }
table.grid td.slotcol .stime { display: block; white-space: nowrap; font-size: 8.5px; letter-spacing: -.2px; }
.cell-course {
  border-radius: 7px;
  padding: 4px 2px;
  background: #eef3ff;
  color: #2b4bb0;
  font-weight: 600;
  font-size: 10px;
  line-height: 1.25;
}
.cell-course .cname {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
}
.cell-course small { display: block; font-weight: 400; color: #5f74a8; font-size: 8.5px; margin-top: 2px; word-break: break-all; }
.cell-heat { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; border-radius: 8px; padding: 2px 0; position: relative; }
.cell-heat.low { background: #fdecec; color: #c92a2a; }
.cell-heat.mid { background: #fff4e2; color: #b26a00; }
.cell-heat.high { background: var(--free-soft); color: #067a58; }
.cell-heat small { display: block; font-size: 9px; font-weight: 500; color: inherit; opacity: .8; }
.cell-heat .dot {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--leave);
}

.seg {
  display: flex;
  padding: 3px;
  border-radius: 12px;
  background: #e9edf7;
  margin-bottom: 10px;
}
.seg button { flex: 1; padding: 7px 0; border-radius: 9px; font-size: 12.5px; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(23, 29, 43, .1); }

/* ------------------------------------------------------------ 请假列表 */
.leave-item { border-bottom: 1px solid var(--line); padding: 10px 0; }
.leave-item:last-child { border-bottom: 0; }
.leave-top { display: flex; align-items: center; gap: 8px; }
.leave-top .who { font-weight: 600; font-size: 14px; }
.leave-when { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.leave-reason { font-size: 12px; color: var(--muted); margin-top: 2px; }
.leave-actions { display: flex; gap: 8px; margin-top: 8px; }
.status { margin-left: auto; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.status.pending { background: #fff4e2; color: #b26a00; }
.status.approved { background: var(--free-soft); color: #067a58; }
.status.rejected { background: #fdecec; color: #c92a2a; }

/* ------------------------------------------------------------ 我的 */
.profile { display: flex; align-items: center; gap: 12px; }
.profile .av-lg {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  flex: none;
}
.profile h2 { font-size: 17px; }
.profile p { font-size: 12px; color: var(--muted); margin-top: 2px; }

.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  width: 100%;
  text-align: left;
  color: inherit;
  text-decoration: none;
  background: none;
  white-space: nowrap;
}
.list-row:last-child { border-bottom: 0; }
.list-row .sub { margin-left: auto; font-size: 12px; color: var(--muted); white-space: normal; text-align: right; max-width: 56%; }
.list-row .ico2 { width: 22px; text-align: center; color: var(--accent); }

.hintbox {
  background: #f7f9ff;
  border: 1px dashed #d9e2f8;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.6;
}
.hintbox code { background: #fff; padding: 1px 5px; border-radius: 5px; border: 1px solid var(--line); font-size: 11px; }

/* ------------------------------------------------------------ 底部导航 */
.tabbar[hidden] { display: none; }

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  max-width: 560px;
  margin: 0 auto;
  padding: 6px 8px calc(6px + var(--safe-b));
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(23, 29, 43, .05);
}
.tab {
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.3;
  border-radius: 12px;
}
.tab .ico { font-size: 17px; line-height: 1; }
.tab em { font-style: normal; }
.tab.active { color: var(--accent); }
.tab.active .ico { transform: translateY(-1px); }

/* ------------------------------------------------------------ 弹层 & 提示 */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-wrap[hidden] { display: none; }
.toast[hidden] { display: none; }
.sheet-mask { position: absolute; inset: 0; background: rgba(15, 20, 32, .38); animation: fade .18s; }
.sheet {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 82dvh;
  overflow-y: auto;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(20px + var(--safe-b));
  animation: up .22s cubic-bezier(.2, .8, .3, 1);
}
.sheet h3 { font-size: 16px; margin-bottom: 4px; }
.sheet .sub { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.sheet-close { position: absolute; right: 14px; top: 12px; font-size: 18px; color: var(--muted); }

@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 90;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(23, 29, 43, .9);
  color: #fff;
  font-size: 13px;
  animation: fade .18s;
  max-width: 80vw;
  text-align: center;
}

.login-wrap { padding: 26px 20px; }
.login-wrap h2 { font-size: 20px; margin-bottom: 6px; }
.login-wrap p { font-size: 13px; color: var(--muted); line-height: 1.6; }
.login-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 16px; }
.login-list button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
  text-align: left;
}
.login-list button .av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11px; flex: none; }
.login-list button small { display: block; color: var(--muted); font-size: 10px; }

.skeleton { height: 90px; border-radius: var(--radius); background: linear-gradient(90deg, #eef1f8 25%, #f7f9fd 37%, #eef1f8 63%); background-size: 400% 100%; animation: shimmer 1.2s infinite; margin-bottom: 10px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.mono { font-variant-numeric: tabular-nums; }
.dim { color: var(--muted); }
.tiny { font-size: 11px; }
.center { text-align: center; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }

