* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  transition: background .2s ease, color .2s ease;
}

:root {
  --bg: #f7f7fb;
  --fg: #1f2328;
  --card: #ffffff;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
}

body.dark {
  --bg: #0b1020;
  --fg: #e6e6f0;
  --card: #11162a;
  --muted: #a3a3b2;
  --border: #2b3042;
  --accent: #7aa2ff;
}

.app-header, .app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2rem);
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.app-footer { border-top: 1px solid var(--border); border-bottom: none; justify-content: center; }

.app-main {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2rem);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

h1, h2 { margin: 0 0 .5rem; }

button, input[type="text"] {
  font: inherit;
  padding: .6rem .8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
}
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button:active { transform: translateY(1px); }

.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.small { margin-top: .5rem; }
.counter-display { font-size: 2rem; font-weight: 700; margin: .25rem 0 .75rem; }
.muted { color: var(--muted); }

.todo-list { list-style: none; padding: 0; margin: .5rem 0 0; }
.todo-list li { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px dashed var(--border); }
.todo-list li:last-child { border-bottom: none; }
.todo-list li.completed .text { text-decoration: line-through; color: var(--muted); }
.todo-list li button.remove { margin-left: auto; }
