:root {
  --ink: #1d2a25;
  --muted: #758079;
  --green: #1e654f;
  --green-dark: #164c3c;
  --paper: #fffefa;
  --line: #e4e2db;
  --danger: #a54940;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  background:
    radial-gradient(circle at 10% 15%, rgba(167, 192, 169, .18), transparent 28rem),
    radial-gradient(circle at 90% 85%, rgba(216, 193, 149, .2), transparent 30rem),
    #f4f2ed;
}

button, input { font: inherit; }
button { cursor: pointer; }

.shell {
  width: min(100% - 32px, 720px);
  margin: 0 auto;
  padding: 10vh 0 48px;
}

.todo-card {
  padding: clamp(28px, 6vw, 52px);
  border: 1px solid rgba(39, 55, 48, .08);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(42, 50, 45, .1);
}

header { margin-bottom: 32px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.eyebrow span {
  width: 18px;
  height: 2px;
  background: #d3a54b;
}

h1 {
  margin: 0;
  font: 800 clamp(38px, 7vw, 58px)/1 "Manrope", sans-serif;
  letter-spacing: -.055em;
}

.subtitle {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.add-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

#todo-input {
  min-width: 0;
  height: 52px;
  padding: 0 17px;
  color: var(--ink);
  border: 1px solid #d6d8d2;
  border-radius: 13px;
  outline: none;
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}

#todo-input::placeholder { color: #9a9f9b; }
#todo-input:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(30,101,79,.1); }

.add-button {
  height: 52px;
  padding: 0 20px;
  color: white;
  border: 0;
  border-radius: 13px;
  background: var(--green);
  font-weight: 700;
  transition: transform .15s, background .2s;
}
.add-button:hover { background: var(--green-dark); }
.add-button:active { transform: scale(.97); }
.add-button span { margin-right: 5px; font-size: 20px; font-weight: 400; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 12px;
}

#task-count { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.filters { display: flex; gap: 4px; }
.filter {
  padding: 6px 10px;
  color: var(--muted);
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}
.filter:hover { color: var(--green); }
.filter.active { color: var(--green); background: #eaf1ed; }

#todo-list { margin: 0; padding: 0; list-style: none; }

.todo-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  min-height: 60px;
  border-bottom: 1px solid #eceae4;
  animation: arrive .25s ease-out;
}

@keyframes arrive { from { opacity: 0; transform: translateY(5px); } }

.check {
  display: grid;
  width: 22px;
  height: 22px;
  padding: 0;
  place-items: center;
  border: 1.5px solid #a6ada8;
  border-radius: 7px;
  background: white;
  color: white;
}
.check:hover { border-color: var(--green); }
.completed .check { border-color: var(--green); background: var(--green); }
.check svg { width: 13px; opacity: 0; }
.completed .check svg { opacity: 1; }

.task-text {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.4;
  text-overflow: ellipsis;
}
.completed .task-text { color: #929892; text-decoration: line-through; text-decoration-color: #b5bab5; }

.actions { display: flex; gap: 2px; opacity: 0; transition: opacity .2s; }
.todo-item:hover .actions, .todo-item:focus-within .actions { opacity: 1; }
.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  color: #7d857f;
  border: 0;
  border-radius: 9px;
  background: transparent;
}
.icon-button:hover { color: var(--green); background: #eef2ef; }
.delete:hover { color: var(--danger); background: #f8edeb; }
.icon-button svg { width: 16px; height: 16px; }

.edit-input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--green);
  border-radius: 8px;
  outline: none;
  box-shadow: 0 0 0 3px rgba(30,101,79,.08);
}

.empty-state { padding: 58px 20px 38px; text-align: center; }
.empty-icon {
  display: grid;
  width: 66px;
  height: 66px;
  margin: 0 auto 20px;
  place-items: center;
  border-radius: 20px;
  background: #eef2ed;
  transform: rotate(-3deg);
}
.empty-icon svg { width: 35px; fill: none; stroke: var(--green); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.empty-state h2 { margin: 0 0 8px; font: 700 18px "Manrope", sans-serif; }
.empty-state p, .filtered-empty { margin: 0; color: var(--muted); font-size: 14px; }
.filtered-empty { padding: 52px 0 28px; text-align: center; }

.footnote { margin: 18px 0 0; color: #858a85; text-align: center; font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 560px) {
  .shell { width: min(100% - 20px, 720px); padding-top: 20px; }
  .todo-card { padding: 26px 20px; border-radius: 22px; }
  .add-form { grid-template-columns: 1fr; }
  .add-button { width: 100%; }
  .toolbar { align-items: flex-start; gap: 12px; flex-direction: column; }
  .actions { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; }
}
