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

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #7b8794;
  --border: #e4e7eb;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --danger: #ef4444;
  --overdue-bg: #fef2f2;
  --overdue-border: #fecaca;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* 顶部栏 */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

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

.header-actions {
  display: flex;
  gap: 8px;
}

/* 按钮 */
.btn {
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.add-btn {
  background: var(--primary);
  color: #fff;
}

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

.outline-btn {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.outline-btn:hover {
  background: #eff6ff;
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
}

.ghost-btn:hover {
  background: #f1f3f5;
}

/* 分组标题 */
.group-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  margin: 20px 0 10px;
}

.group:first-of-type .group-title {
  margin-top: 0;
}

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

.task {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.task.overdue {
  background: var(--overdue-bg);
  border-color: var(--overdue-border);
}

.task input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

.task-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-title {
  font-size: 16px;
  word-break: break-word;
}

.task-meta {
  font-size: 13px;
  color: var(--muted);
}

.task.overdue .task-meta {
  color: var(--danger);
  font-weight: 600;
}

/* 归档项弱化 */
.task.archived {
  opacity: 0.72;
}

.task.archived .task-title {
  color: var(--muted);
  text-decoration: line-through;
}

/* 归档日期分组 */
.archive-group {
  margin-bottom: 18px;
}

.archive-date {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.archive-filter {
  width: auto;
  min-width: 160px;
  padding: 8px 12px;
  margin-bottom: 12px;
  cursor: pointer;
}

.del-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 14px;
  color: var(--danger);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.del-btn:hover {
  background: var(--overdue-bg);
}

.empty-tip {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
  display: none;
}

/* 弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: #fff;
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.field-label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 6px;
}

.input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--text);
  -webkit-appearance: none;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.modal-actions .btn {
  flex: 1;
}
