:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --border: #e4e4e7;
  --text: #1a1a1a;
  --dim: #888;
  --accent: #6d28d9;
}
:root[data-theme="dark"] {
  --bg: #18181b;
  --card: #232326;
  --border: #35353a;
  --text: #f4f4f5;
  --dim: #9a9aa2;
  --accent: #a78bfa;
}

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

body {
  font-family: "Vazirmatn", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.25s, color 0.25s;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.header h1 {
  font-size: 1.6rem;
  font-weight: 700;
}
.theme-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 40px; height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text);
}
.theme-btn:hover { background: var(--card); }

.input-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.task-input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
}
.task-input:focus { border-color: var(--accent); }
.add-btn {
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}
.add-btn:hover { opacity: 0.9; }

.filters {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.filter {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--dim);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.filter.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}
.item input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.item-text {
  flex: 1;
  font-size: 0.98rem;
  word-break: break-word;
}
.item.done .item-text {
  text-decoration: line-through;
  color: var(--dim);
}
.del {
  border: none;
  background: none;
  color: var(--dim);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}
.del:hover { color: #ef4444; }

.empty {
  text-align: center;
  color: var(--dim);
  padding: 2rem 0;
  font-size: 0.95rem;
}

.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.2rem;
  font-size: 0.85rem;
  color: var(--dim);
}
.clear {
  border: none;
  background: none;
  color: var(--dim);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
}
.clear:hover { color: var(--text); }

.footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.8rem;
}
.footer a {
  color: var(--accent);
  text-decoration: none;
}
.footer a:hover { text-decoration: underline; }