:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2430;
  --text-soft: #6b7385;
  --line: #e6e9f2;
  --brand: #2f6df6;
  --brand-soft: #eaf1ff;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --high: #e5484d;
  --high-soft: #fdecec;
  --medium: #d98800;
  --medium-soft: #fff4e0;
  --low: #2f8f6b;
  --low-soft: #e7f6f0;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(31, 36, 48, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 48px 16px 64px;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 15% -10%, #e4edff 0%, transparent 60%),
    radial-gradient(800px 500px at 100% 0%, #eafaf3 0%, transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

/* ---------- 头部 ---------- */
.app__header { margin-bottom: 26px; }

.app__title {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.5px;
}

.app__subtitle {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--text-soft);
}

/* ---------- 添加区 ---------- */
.composer {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.composer__input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  font-size: 15px;
  color: var(--text);
  background: #f8f9fc;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color .18s, background .18s, box-shadow .18s;
}

.composer__input::placeholder { color: #a2a9ba; }

.composer__input:focus {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.composer__select {
  height: 44px;
  padding: 0 34px 0 14px;
  font-size: 15px;
  color: var(--text);
  background: #f8f9fc
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7385'/%3E%3C/svg%3E")
    no-repeat right 13px center;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s;
}

.composer__select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.composer__btn {
  height: 44px;
  padding: 0 22px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #4b83ff, var(--brand));
  border: none;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s, box-shadow .18s, opacity .18s;
}

.composer__btn:hover { box-shadow: 0 6px 18px rgba(47, 109, 246, .32); }
.composer__btn:active { transform: translateY(1px); }
.composer__btn:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }

/* ---------- 筛选 ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 14px;
}

.filters__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  font-size: 14px;
  color: var(--text-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all .16s;
}

.filters__item:hover { border-color: #cfd6e6; color: var(--text); }

.filters__item.is-active {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: #c5dbff;
  font-weight: 600;
}

.filters__count {
  min-width: 18px;
  padding: 0 5px;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  color: var(--text-soft);
  background: #eef1f7;
  border-radius: 999px;
}

.filters__item.is-active .filters__count {
  color: #fff;
  background: var(--brand);
}

/* ---------- 列表 ---------- */
.list-wrap {
  position: relative;
  min-height: 140px;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(31, 36, 48, .04);
  animation: taskIn .22s ease-out both;
}

@keyframes taskIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.task.is-removing {
  animation: taskOut .2s ease-in forwards;
}

@keyframes taskOut {
  to { opacity: 0; transform: translateX(24px); }
}

/* 优先级色条 */
.task::before {
  content: "";
  width: 4px;
  align-self: stretch;
  border-radius: 4px;
  background: var(--line);
}

.task[data-priority="high"]::before { background: var(--high); }
.task[data-priority="medium"]::before { background: var(--medium); }
.task[data-priority="low"]::before { background: var(--low); }

.task__body { flex: 1; min-width: 0; }

.task__title {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  transition: color .18s;
}

.task.is-done .task__title {
  color: #9aa1b2;
  text-decoration: line-through;
  text-decoration-color: #b9c0cf;
}

.task__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-soft);
}

.pill {
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
}

.pill--high { color: var(--high); background: var(--high-soft); }
.pill--medium { color: var(--medium); background: var(--medium-soft); }
.pill--low { color: var(--low); background: var(--low-soft); }

.task__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-mini {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-soft);
  cursor: pointer;
  transition: all .16s;
  white-space: nowrap;
}

.btn-mini:hover { background: #f6f8fc; color: var(--text); }
.btn-mini:disabled { opacity: .5; cursor: not-allowed; }

.btn-mini--done {
  color: var(--brand);
  border-color: #c5dbff;
  background: var(--brand-soft);
}

.btn-mini--done:hover { background: #dfe9ff; color: var(--brand); }

.btn-mini--undo { color: var(--low); border-color: #c8e8dc; background: var(--low-soft); }
.btn-mini--undo:hover { background: #d9f2e8; color: var(--low); }

.btn-mini--del { color: var(--danger); border-color: #f6d2d3; background: var(--danger-soft); }
.btn-mini--del:hover { background: #fbdedf; color: var(--danger); }

/* ---------- 空状态 / 加载 / 错误 ---------- */
.empty {
  padding: 52px 16px;
  text-align: center;
  color: var(--text-soft);
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.empty__icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  font-size: 22px;
  line-height: 52px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 50%;
}

.empty__text { margin: 0; font-size: 14px; }

.loading {
  padding: 40px 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-soft);
}

.banner {
  margin-top: 14px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #f6d2d3;
  border-radius: 10px;
}

/* ---------- 页脚 ---------- */
.app__footer {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: #9aa1b2;
}

/* ---------- 移动端 ---------- */
@media (max-width: 560px) {
  body { padding: 28px 12px 48px; }
  .app__title { font-size: 24px; }

  .composer { flex-wrap: wrap; }
  .composer__input { flex: 1 1 100%; }
  .composer__select { flex: 1; }
  .composer__btn { flex: 1; padding: 0 14px; }

  .task { padding: 12px; gap: 10px; }
  .task__actions { flex-direction: column; }
  .btn-mini { width: 100%; }
}
