:root {
  --navy: #1F3864;
  --navy-2: #2c4d86;
  --ink: #1f2329;
  --muted: #6b7280;
  --bg: #f4f5f7;
  --card: #ffffff;
  --line: #e5e7eb;
  --accent: #C55A11;
  --green: #375623;
  --red: #C00000;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; }

/* 登录 */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1F3864 0%, #2c4d86 100%); z-index: 100; padding: 20px; }
.login-card { background: #fff; border-radius: 18px; padding: 28px 22px; width: 100%; max-width: 340px; text-align: center; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; color: var(--navy); }
.login-card p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.login-card input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; margin-bottom: 12px; }
.login-card button { width: 100%; padding: 12px; border: 0; border-radius: 10px; background: var(--navy); color: #fff; font-size: 15px; }
.err { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 8px; }

/* 框架 */
.app { min-height: 100dvh; }
.side { display: none; }
.main { padding: 14px 14px 88px; max-width: 760px; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.crumb { font-weight: 600; color: var(--navy); font-size: 16px; }
.today-date { color: var(--muted); font-size: 12px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: #fff;
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
.tab-btn { flex: 1; padding: 10px 0 11px; border: 0; background: none; color: var(--muted); font-size: 12px; }
.tab-btn.active, .nav-btn.active { color: var(--navy); font-weight: 700; }

@media (min-width: 900px) {
  .side { display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0; width: 232px;
    background: var(--navy); color: #fff; padding: 22px 16px; }
  .main { margin-left: 232px; max-width: 900px; padding: 26px 36px 40px; }
  .tabbar { display: none; }
  .brand { display: flex; gap: 10px; align-items: center; margin-bottom: 26px; }
  .brand .logo { width: 38px; height: 38px; border-radius: 10px; background: #fff; color: var(--navy);
    display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; }
  .brand b { display: block; font-size: 16px; }
  .brand small { color: #c9d4e8; font-size: 11px; }
  .side-nav { display: flex; flex-direction: column; gap: 4px; }
  .nav-btn { text-align: left; padding: 11px 12px; border-radius: 10px; border: 0; background: none;
    color: #dbe4f2; font-size: 14px; }
  .nav-btn.active { background: rgba(255,255,255,.14); color: #fff; }
  .side-foot { margin-top: auto; background: rgba(255,255,255,.08); border-radius: 12px; padding: 14px; }
  .cd-label { font-size: 11px; color: #c9d4e8; }
  .cd-days { font-size: 34px; font-weight: 800; line-height: 1.1; }
  .cd-exam, .cd-phase { font-size: 11px; color: #c9d4e8; margin-top: 2px; }
}

/* 通用卡片与按钮 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-h h2 { margin: 0; font-size: 16px; }
.btn { border: 0; border-radius: 10px; padding: 10px 16px; font-size: 14px; background: var(--navy);
  color: #fff; cursor: pointer; }
.btn.ghost { background: #eef1f6; color: var(--navy); }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.danger { background: #fbe9e9; color: var(--red); }
.btn:active { transform: translateY(1px); }
input, select, textarea { font: inherit; color: inherit; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; width: 100%; }
textarea { resize: vertical; min-height: 62px; }
label.field { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }

/* 今日 */
.hero { background: linear-gradient(150deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; }
.hero .phase-badge { display: inline-block; font-size: 11px; background: rgba(255,255,255,.18);
  border-radius: 20px; padding: 2px 10px; margin-right: 6px; }
.hero h2 { color: #fff; font-size: 18px; margin: 8px 0 2px; }
.hero .date { color: #c9d4e8; font-size: 12px; }
.hero .cd { margin-top: 14px; display: flex; align-items: baseline; gap: 8px; }
.hero .cd b { font-size: 30px; font-weight: 800; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.badge { font-size: 11px; padding: 2px 9px; border-radius: 20px; background: #eef1f6; color: var(--navy); }
.badge.warn { background: #fdf0e6; color: var(--accent); }
.badge.green { background: #e2efda; color: var(--green); }
.badge.red { background: #fbe4e4; color: var(--red); }

.task-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.task-item .k { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.task-item .v { margin-top: 3px; font-size: 14.5px; }
.task-check { display: flex; align-items: center; gap: 10px; background: #f8f9fb; border-radius: 12px; padding: 12px; margin-top: 6px; }
.task-check input { width: 20px; height: 20px; accent-color: var(--navy); }
.guarantee { font-size: 12px; color: var(--muted); background: #fafbfc; border: 1px dashed var(--line);
  border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.done-flag { color: var(--green); font-weight: 700; }

/* 周视图 */
.week-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.week-head .title { font-weight: 700; flex: 1; }
.day-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px;
  margin-bottom: 8px; display: flex; gap: 12px; }
.day-card.done { border-color: #b7d3a8; background: #f6fbf2; }
.day-card .left { width: 54px; flex: 0 0 54px; }
.day-card .wd { font-size: 11px; color: var(--muted); }
.day-card .dn { font-weight: 700; font-size: 15px; }
.day-card .body { flex: 1; min-width: 0; }
.day-card .c { font-size: 13.5px; }
.day-card .t { font-size: 12px; color: var(--muted); margin-top: 3px; }
.day-card .note { font-size: 12px; color: var(--accent); margin-top: 3px; }
.day-card input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--navy); margin-top: 2px; }
.day-card.today { box-shadow: 0 0 0 2px rgba(31,56,100,.25); }
.day-card.rest { background: #fafbfc; border-style: dashed; }
.day-card.future { opacity: .6; }
.day-card .right { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.task-check.rest-day { background: #f6fbf2; border: 1px dashed #b7d3a8; }

/* 月历 */
.month-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.month-head .title { flex: 1; font-weight: 700; font-size: 17px; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.month-grid .wd { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.cell { min-height: 62px; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 5px; font-size: 11px; cursor: pointer; position: relative; overflow: hidden; }
.cell.empty { background: transparent; border-color: transparent; cursor: default; }
.cell .dnum { font-weight: 700; font-size: 12.5px; }
.cell .tag { display: block; margin-top: 2px; color: var(--muted); font-size: 9.5px; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell.intern { background: #E2EFDA; }
.cell.exam { background: #FBE4E4; border-color: var(--red); }
.cell.exam .dnum { color: var(--red); }
.cell.today { outline: 2px solid var(--navy); outline-offset: -2px; }
.cell.rest { background: #f4f5f7; }
.cell .rest-mark { position: absolute; right: 4px; bottom: 2px; font-size: 9px; color: #8a94a6; }
.cell.done::after { content: "✓"; position: absolute; right: 4px; top: 2px; color: var(--green);
  font-weight: 800; font-size: 12px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin: 8px 0 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* 我的 */
.subtabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.subtabs button { border: 0; background: #eef1f6; color: var(--navy); padding: 8px 14px; border-radius: 20px; font-size: 13px; }
.subtabs button.active { background: var(--navy); color: #fff; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mistake { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; background: #fff; }
.mistake .hd { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.mistake .hd b { font-size: 14px; }
.mistake .memo { font-size: 13px; margin-top: 4px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat .n { font-size: 26px; font-weight: 800; color: var(--navy); }
.stat .l { font-size: 12px; color: var(--muted); }
.bar-row { margin: 10px 0; }
.bar-row .lab { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.bar { height: 8px; background: #eef1f6; border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--navy); border-radius: 6px; }
.draw-card { text-align: center; padding: 26px 16px; }
.draw-card .pid { font-size: 12px; color: var(--muted); letter-spacing: .1em; }
.draw-card .pname { font-size: 20px; font-weight: 800; margin: 8px 0 14px; color: var(--navy); }
.draw-card .pans { font-size: 14.5px; text-align: left; background: #f8f9fb; border-radius: 10px; padding: 12px; margin: 12px 0; }
.draw-btns { justify-content: center; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: rgba(31,35,41,.92);
  color: #fff; font-size: 13px; padding: 9px 16px; border-radius: 20px; opacity: 0; pointer-events: none;
  transition: opacity .2s; z-index: 60; }
.toast.show { opacity: 1; }
.empty-tip { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0; }
