* { 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", sans-serif;
  background: #eef2f7;
  color: #1f2937;
  line-height: 1.5;
}
.app {
  max-width: 560px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 14px calc(env(safe-area-inset-bottom) + 24px);
}

.top {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  border-radius: 18px;
  padding: 16px 18px 18px;
  margin-top: 10px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .25);
}
.top-title { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; flex: none;
}
.top h1 { margin: 0; font-size: 21px; letter-spacing: 1px; }
.subtitle { margin: 2px 0 0; font-size: 13px; opacity: .9; }
.top-stats { display: flex; gap: 8px; margin-top: 14px; }
.stat {
  flex: 1; background: rgba(255,255,255,.15); border-radius: 12px;
  padding: 8px 6px; text-align: center; font-size: 12px;
}
.stat b { display: block; font-size: 18px; }

.datebar { display: flex; align-items: center; gap: 10px; margin: 16px 0 6px; }
.roundbtn {
  width: 46px; height: 46px; border-radius: 50%; border: none; flex: none;
  background: #fff; color: #2563eb; font-size: 28px; line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,.08); cursor: pointer;
}
.datebox {
  flex: 1; position: relative; background: #fff; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 0 12px; box-shadow: 0 2px 8px rgba(0,0,0,.08);
  cursor: pointer;
}
.datebox #dateText { font-size: 19px; font-weight: 700; }
.datebox #weekText { font-size: 13px; color: #6b7280; margin-top: 2px; }
.datebox input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
}
.actionrow { display: flex; align-items: center; justify-content: space-between; margin: 4px 4px 12px; }
.ghost {
  border: none; background: none; color: #2563eb; font-size: 14px; padding: 8px 10px; cursor: pointer;
}
.daydone { font-size: 13px; color: #6b7280; }

.daycard {
  background: #fff; border-radius: 18px; padding: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.phase {
  font-size: 13px; color: #2563eb; font-weight: 600;
  background: #eff6ff; border-radius: 999px; padding: 5px 12px;
  display: inline-block; margin: 2px 4px 12px;
}
.task {
  display: flex; align-items: flex-start; gap: 12px;
  border: 1.5px solid #e5e7eb; border-radius: 14px; padding: 12px 12px 12px 8px;
  margin-bottom: 10px; cursor: pointer; transition: border-color .15s, background .15s;
}
.task input { display: none; }
.task .box {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid #cbd5e1;
  flex: none; margin: 2px 2px 0 4px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 800;
  transition: all .15s;
}
.task .taskbody { display: flex; flex-direction: column; gap: 2px; }
.tasklabel { font-size: 12px; color: #6b7280; font-weight: 600; }
.tasktext { font-size: 15px; font-weight: 500; }
.task.done { border-color: #22c55e; background: #f0fdf4; }
.task.done .box { background: #22c55e; border-color: #22c55e; }
.task.done .box::after { content: "✓"; }
.task-review { border-style: dashed; }

.note { margin-top: 4px; }
.note label { font-size: 13px; color: #6b7280; }
.note textarea {
  width: 100%; margin-top: 6px; border: 1.5px solid #e5e7eb; border-radius: 12px;
  padding: 10px; font: inherit; font-size: 14px; resize: vertical; background: #f9fafb;
}
.note textarea:focus { outline: none; border-color: #2563eb; background: #fff; }
.save-state { font-size: 12px; color: #9ca3af; text-align: right; margin-top: 4px; min-height: 16px; }

.weekcard {
  background: #fff; border-radius: 18px; padding: 14px 14px 12px; margin-top: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.weekcard h2 { margin: 0 0 10px; font-size: 15px; color: #374151; }
.dots { display: flex; flex-wrap: wrap; gap: 6px; }
.dot {
  width: 30px; height: 30px; border-radius: 10px; background: #f3f4f6;
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: #6b7280;
}
.dot.full { background: #dcfce7; color: #16a34a; font-weight: 700; }
.dot.today { outline: 2px solid #2563eb; outline-offset: 1px; }
.weeknote { font-size: 12px; color: #9ca3af; margin: 8px 2px 0; }

.foot { text-align: center; font-size: 12px; color: #9ca3af; margin-top: 18px; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: rgba(17,24,39,.85); color: #fff; font-size: 14px;
  padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .25s; z-index: 50; max-width: 90%;
}
.toast.show { opacity: 1; }

.userswitch {
  display: flex; gap: 8px; background: #fff; border-radius: 999px; padding: 5px;
  margin: 14px 0 2px; box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.userbtn {
  flex: 1; border: none; background: none; border-radius: 999px;
  padding: 10px 8px; font-size: 15px; font-weight: 600; color: #6b7280; cursor: pointer;
}
.userbtn.active { background: #2563eb; color: #fff; }

.monthcard {
  background: #fff; border-radius: 18px; padding: 14px 14px 12px; margin-top: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.monthhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.monthtitle { text-align: center; flex: 1; }
.monthtitle h2 { margin: 0; font-size: 15px; color: #374151; }
.monthtitle span { font-size: 13px; color: #6b7280; }
.monthnav {
  width: 38px; height: 38px; border: none; border-radius: 50%; background: #f3f4f6;
  color: #2563eb; font-size: 24px; line-height: 1; cursor: pointer; flex: none;
}
.weekhead { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 12px; color: #9ca3af; margin-bottom: 4px; }
.monthgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.mcell { min-height: 34px; border-radius: 9px; border: none; background: #f9fafb; font-size: 13px; color: #6b7280; cursor: pointer; position: relative; }
.mcell.empty { background: none; cursor: default; }
.mcell.full { background: #22c55e; color: #fff; font-weight: 700; }
.mcell.partial { background: #d1fae5; color: #065f46; }
.mcell.today { outline: 2px solid #2563eb; outline-offset: 1px; }
.mcell.selected { box-shadow: inset 0 0 0 2px #2563eb; }
.mcell.off { opacity: .38; }
