:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --high: #dc2626;
  --high-bg: #fee2e2;
  --medium: #d97706;
  --medium-bg: #fef3c7;
  --low: #16a34a;
  --low-bg: #dcfce7;
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #eff6ff 0%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
  padding: 40px 16px;
}

.app {
  max-width: 680px;
  margin: 0 auto;
}

/* 标题区 */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.logo {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.header h1 {
  font-size: 24px;
  font-weight: 700;
}

.subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
}

/* 添加表单 */
.add-form {
  display: flex;
  gap: 10px;
}

.add-form input {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.add-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.add-form select {
  width: 128px;
  height: 40px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  outline: none;
  cursor: pointer;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 列表头 + 筛选 */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.list-header h2 {
  margin-bottom: 0;
}

.filters {
  display: inline-flex;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.filter {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

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

.filter.active {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
}

/* 任务列表 */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  transition: background 0.15s;
}

.task-item:hover {
  background: #f8fafc;
}

/* 完成切换 */
.toggle {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  color: transparent;
}

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

.toggle.completed {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.toggle svg {
  width: 13px;
  height: 13px;
}

.task-title {
  flex: 1;
  font-size: 14px;
  word-break: break-word;
}

.task-title.completed {
  text-decoration: line-through;
  color: #94a3b8;
}

/* 优先级徽章 */
.priority-badge {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.priority-badge.high {
  background: var(--high-bg);
  color: var(--high);
}

.priority-badge.medium {
  background: var(--medium-bg);
  color: var(--medium);
}

.priority-badge.low {
  background: var(--low-bg);
  color: var(--low);
}

/* 删除按钮 */
.delete-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.delete-btn:hover {
  background: #fee2e2;
  color: var(--danger);
}

.delete-btn svg {
  width: 15px;
  height: 15px;
}

/* 空状态 */
.empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 40px 0;
}

/* 底部 */
.footer {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

@media (max-width: 560px) {
  .add-form {
    flex-direction: column;
  }

  .add-form select {
    width: 100%;
  }

  .btn-primary {
    justify-content: center;
  }

  .list-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
