/* ===== 今日待办 - 移动端优先样式 ===== */
:root {
  --bg: #f4f5fb;
  --card: #ffffff;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #eef2ff;
  --text: #1e2235;
  --text-2: #8a90a6;
  --line: #e6e8f0;
  --danger: #ef4444;
  --green: #22c55e;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(30, 34, 53, .07);
}

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

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ===== 登录 / 注册 ===== */
#auth-view {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(160deg, #eef2ff 0%, #f4f5fb 45%, #fdf2f8 100%);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 36px 28px 28px;
  text-align: center;
}
.auth-logo { font-size: 52px; line-height: 1; }
.auth-title { font-size: 1.5rem; margin-top: 12px; letter-spacing: .5px; }
.auth-sub { color: var(--text-2); font-size: .875rem; margin-top: 6px; }

.seg-tabs {
  display: flex; margin-top: 24px;
  background: var(--bg); border-radius: 12px; padding: 4px;
}
.seg-tab {
  flex: 1; border: 0; background: transparent;
  padding: 10px 0; border-radius: 9px;
  font-size: .95rem; color: var(--text-2);
  cursor: pointer; transition: all .18s;
}
.seg-tab.active { background: var(--card); color: var(--primary-dark); font-weight: 600; box-shadow: 0 2px 8px rgba(30,34,53,.08); }

#auth-form { margin-top: 20px; text-align: left; }
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: .8rem; color: var(--text-2); margin-bottom: 6px; }
.field input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 1rem; color: var(--text);
  background: #fbfbfe; outline: none; transition: border-color .15s;
}
.field input:focus { border-color: var(--primary); background: #fff; }

.form-error {
  color: var(--danger); font-size: .82rem;
  background: #fef2f2; border: 1px solid #fecaca;
  padding: 8px 12px; border-radius: 9px; margin-bottom: 12px;
}

.btn-primary {
  width: 100%; border: 0; border-radius: 12px;
  background: var(--primary); color: #fff;
  padding: 13px 0; font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: background .15s, transform .1s;
}
.btn-primary:active { transform: scale(.98); background: var(--primary-dark); }
.btn-primary:disabled { opacity: .6; pointer-events: none; }

.auth-hint { margin-top: 18px; font-size: .78rem; color: var(--text-2); }

/* ===== 主界面 ===== */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-icon { font-size: 26px; }
.app-title { font-size: 1.15rem; letter-spacing: .3px; }
.date-line { font-size: .75rem; color: var(--text-2); }
.header-right { display: flex; align-items: center; gap: 8px; }
.user-chip {
  font-size: .78rem; color: var(--primary-dark);
  background: var(--primary-light);
  padding: 5px 10px; border-radius: 999px;
  max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-ghost {
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  font-size: .8rem; padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.btn-ghost:active { background: var(--bg); }

.container { max-width: 640px; margin: 0 auto; padding: 18px 16px 60px; }

/* 添加栏 */
.add-bar {
  display: flex; gap: 10px;
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 10px 10px 10px 16px;
}
.add-bar input {
  flex: 1; border: 0; outline: none; font-size: 1rem; color: var(--text);
  background: transparent; min-width: 0;
}
.add-bar input::placeholder { color: #b3b8c9; }
.add-bar.shake { animation: shake .35s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
.btn-add {
  width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 12px;
  background: var(--primary); color: #fff;
  font-size: 1.5rem; line-height: 1; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-add:active { transform: scale(.92); background: var(--primary-dark); }

/* 统计行 */
.stats-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px;
}
.stat-card {
  flex: 1; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 4px;
}
.stat-num { font-size: 1.35rem; font-weight: 700; color: var(--primary-dark); }
.stat-label { font-size: .72rem; color: var(--text-2); margin-top: 2px; }
.btn-clear {
  border: 1px solid var(--line); background: var(--card); color: var(--text-2);
  font-size: .78rem; padding: 9px 12px; border-radius: 12px;
  cursor: pointer; white-space: nowrap;
}
.btn-clear:active { background: var(--bg); }

/* 筛选 */
.filter-row { display: flex; gap: 8px; margin-top: 18px; }
.filter-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text-2);
  font-size: .82rem; padding: 7px 16px; border-radius: 999px; cursor: pointer;
  transition: all .15s;
}
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 500; }

/* 列表 */
.todo-list { list-style: none; margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.todo-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 14px 14px 16px;
  animation: pop .22s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.todo-item.removing { opacity: 0; transform: translateX(30px); transition: all .2s; }

.check-btn {
  width: 26px; height: 26px; flex: none;
  border: 2px solid #cfd3e2; border-radius: 50%;
  background: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; padding: 0;
}
.check-btn svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 3.4; fill: none; opacity: 0; transform: scale(.4); transition: all .15s; }
.todo-item.done .check-btn { background: var(--green); border-color: var(--green); }
.todo-item.done .check-btn svg { opacity: 1; transform: scale(1); }

.todo-text {
  flex: 1; font-size: .98rem; word-break: break-word;
  transition: color .2s; min-width: 0;
}
.todo-item.done .todo-text { color: #aab0c4; text-decoration: line-through; text-decoration-color: #c9cedd; }

.del-btn {
  width: 32px; height: 32px; flex: none;
  border: 0; border-radius: 9px; background: transparent;
  color: #c3c8d8; font-size: 1.15rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.del-btn:active { background: #fef2f2; color: var(--danger); }

/* 空状态 */
.empty-state { text-align: center; padding: 48px 0 30px; }
.empty-icon { font-size: 44px; }
.empty-title { margin-top: 12px; font-weight: 600; color: var(--text); }
.empty-sub { font-size: .85rem; color: var(--text-2); margin-top: 4px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #2a2f45; color: #fff;
  font-size: .85rem; padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 6px 24px rgba(30,34,53,.25);
  z-index: 100; animation: toast-in .25s ease;
  max-width: 86vw; text-align: center;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 桌面端微调 */
@media (min-width: 641px) {
  .container { padding-top: 26px; }
  .todo-item:hover .del-btn { color: #9aa1b5; }
}
