:root {
  --bg: #f6f7fb; --card: #fff; --ink: #1f2430; --muted: #6b7280;
  --accent: #2563eb; --accent-soft: #e8efff; --green: #16a34a; --green-soft: #e7f6ec;
  --red: #dc2626; --line: #e5e7eb;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.6;
  padding: calc(12px + var(--safe-top)) 14px calc(76px + var(--safe-bottom));
}
button { font-family: inherit; touch-action: manipulation; }

[hidden] { display: none !important; }

#updateBanner {
  position: fixed; top: calc(8px + var(--safe-top)); left: 50%; transform: translateX(-50%);
  z-index: 50; display: flex; gap: 10px; align-items: center;
  background: #1f2430; color: #fff; border-radius: 999px; padding: 8px 16px; font-size: 13px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
#updateBanner button { border: 0; background: var(--accent); color: #fff; border-radius: 999px; padding: 4px 12px; font-size: 13px; }

.app-header { text-align: center; margin-bottom: 14px; }
.app-title { font-size: 22px; font-weight: 700; }
.app-sub { font-size: 13px; color: var(--muted); }

.view { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h2 .right { margin-left: auto; color: var(--accent); font-size: 13px; font-weight: 600; }
.badge { font-size: 12px; color: var(--muted); background: #f1f3f7; border-radius: 999px; padding: 2px 10px; }

.task { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.task input { width: 18px; height: 18px; margin-top: 4px; accent-color: var(--accent); flex: none; }
.task .t-title { font-weight: 600; font-size: 14px; }
.task .t-desc { font-size: 12px; color: var(--muted); }
.task.done { background: var(--green-soft); border-color: #bfe5cd; }
.task.done .t-title { color: var(--green); }

.progress-bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress-bar > div { height: 100%; background: var(--green); width: 0; transition: width .3s; }
.progress-text { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; }

.en-line { display: block; font-size: 15px; padding: 3px 0; }
.zh { color: var(--muted); font-size: 13px; margin-top: 8px; }
.hide-zh .zh { display: none; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 14px; font-size: 13px; color: var(--ink); min-height: 44px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.hint { font-size: 12px; color: var(--muted); }

.list-row { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; background: #fff; }
.list-row .day-badge { font-size: 12px; color: var(--accent); font-weight: 600; flex: none; width: 58px; }
.list-row .first-line { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mistake { border-left: 3px solid var(--red); background: #fdf3f3; border-radius: 0 8px 8px 0; padding: 8px 12px; font-size: 13px; margin-bottom: 8px; }
.mistake b { color: var(--red); }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { text-align: center; font-size: 12px; color: var(--muted); }
.day { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13px; user-select: none; }
.day .em { font-size: 14px; height: 18px; }
.day.future { opacity: .45; }
.day.weekend { background: #fbfbfd; }

.field { margin-bottom: 10px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 15px; font-family: inherit; background: #fff; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent-soft, #e8efff); border-color: var(--accent); }

.acct-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: #fafbfc; }
.acct-row .name { font-size: 14px; font-weight: 600; }
.acct-row .why { font-size: 12px; color: var(--muted); }
.acct-row .tag { margin-left: auto; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; flex: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}
.tab { flex: 1; border: 0; background: none; padding: 8px 0 6px; font-size: 12px; color: var(--muted); min-height: 56px; }
.tab .tab-ico { display: block; font-size: 20px; }
.tab.active { color: var(--accent); font-weight: 600; }

#loadError { position: fixed; inset: 40% 16px auto; text-align: center; color: var(--red); font-size: 14px; }

@media (min-width: 640px) {
  main { max-width: 640px; margin: 0 auto; }
  .app-header { max-width: 640px; margin-left: auto; margin-right: auto; }
}
