:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1b1d21;
  --text-soft: #6b7280;
  --line: #e8eaee;
  --primary: #2f6fed;
  --primary-soft: #eaf1ff;
  --high: #e5484d;
  --high-bg: #fdecec;
  --medium: #d98506;
  --medium-bg: #fdf3e3;
  --low: #109b86;
  --low-bg: #e8f7f4;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 28px -12px rgba(16, 24, 40, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 40px 16px 64px;
  background: radial-gradient(1200px 600px at 50% -10%, #eef3ff 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- 头部 ---------- */
.app__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.app__title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

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

.summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-soft);
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.summary b { color: var(--text); font-weight: 600; }
.summary__divider { width: 1px; height: 14px; background: var(--line); }

/* ---------- 添加任务 ---------- */
.composer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.composer__form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

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

.composer__input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.composer__select {
  height: 44px;
  padding: 0 34px 0 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fafbfc url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.composer__select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.composer__submit {
  height: 44px;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
  box-shadow: 0 6px 14px -6px rgba(47, 111, 237, 0.6);
}

.composer__submit:hover { background: #2760d6; }
.composer__submit:active { transform: translateY(1px); }
.composer__submit:disabled { opacity: 0.6; cursor: not-allowed; }

.composer__error {
  margin: 10px 2px 0;
  font-size: 13px;
  color: var(--high);
}

/* ---------- 筛选栏 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 2px 12px;
  flex-wrap: wrap;
}

.filters {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #eceef2;
  border-radius: 10px;
}

.filter {
  min-width: 54px;
  height: 32px;
  padding: 0 14px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-soft);
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}

.filter:hover { color: var(--text); }

.filter.is-active {
  color: var(--text);
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1);
}

.backend {
  font-size: 12px;
  color: var(--text-soft);
  padding: 3px 10px;
  border: 1px dashed #cfd4dc;
  border-radius: 999px;
}

/* ---------- 任务列表 ---------- */
.list-wrap { position: relative; }

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

.task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px 13px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
  transition: border-color 0.18s, box-shadow 0.18s, opacity 0.18s, transform 0.18s;
  animation: rise 0.22s ease-out;
}

.task:hover {
  border-color: #d7dbe3;
  box-shadow: 0 6px 16px -8px rgba(16, 24, 40, 0.22);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* 完成状态切换按钮（圆形勾选） */
.task__toggle {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.6px solid #c6ccd6;
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 12px;
  line-height: 1;
  transition: background 0.16s, border-color 0.16s, color 0.16s;
}

.task__toggle:hover { border-color: var(--primary); }

.task__toggle.is-done {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

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

.task__title {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
  transition: color 0.18s;
}

.task.is-done .task__title {
  color: #98a0ac;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.task__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  font-size: 12px;
  color: #9aa1ac;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
}

.tag--high { color: var(--high); background: var(--high-bg); }
.tag--medium { color: var(--medium); background: var(--medium-bg); }
.tag--low { color: var(--low); background: var(--low-bg); }

.task.is-done .tag { opacity: 0.55; }

.task__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.btn {
  height: 30px;
  padding: 0 11px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text-soft);
  background: #f5f6f8;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
  white-space: nowrap;
}

.btn:hover { background: #eceef2; color: var(--text); }

.btn--danger:hover {
  background: var(--high-bg);
  color: var(--high);
  border-color: #f6cfd0;
}

/* ---------- 空态 / 加载 ---------- */
.empty {
  padding: 46px 20px 52px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed #dcdfe6;
  border-radius: var(--radius);
}

.empty__icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 20px;
}

.empty__title { margin: 0; font-weight: 600; }
.empty__desc { margin: 4px 0 0; font-size: 13px; color: var(--text-soft); }

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

/* ---------- 响应式 ---------- */
@media (max-width: 560px) {
  body { padding: 22px 12px 48px; }
  .app__title { font-size: 22px; }
  .app__header { align-items: flex-start; }
  .composer__form { flex-direction: column; }
  .composer__input,
  .composer__select,
  .composer__submit { width: 100%; flex: none; }
  .composer__select { padding-right: 34px; }
  .task { flex-wrap: wrap; }
  .task__actions { width: 100%; justify-content: flex-end; }
}
