:root{
  --bg:#f8f9fb;
  --card:#ffffff;
  --text:#222;
  --muted:#6b7280;
  --primary:#2563eb;
  --primary-weak:#e0e7ff;
  --border:#e5e7eb;
  --focus:#93c5fd;
  --radius:16px;
  --shadow:0 6px 24px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background:var(--bg);
  color:var(--text);
  line-height:1.5;
}

.container{
  max-width:720px;
  margin:48px auto;
  padding:24px;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}

.header{
  display:grid;
  gap:12px;
  margin-bottom:16px;
}
h1{margin:0;font-size:1.6rem}

.add-form{
  display:flex;
  gap:8px;
}
.add-form input{
  flex:1;
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  outline:none;
}
.add-form input:focus{border-color:var(--focus); box-shadow:0 0 0 4px var(--primary-weak)}

.btn{
  padding:10px 14px;
  border:1px solid var(--border);
  background:#fff;
  border-radius:12px;
  cursor:pointer;
  font:inherit;
}
.btn:hover{background:#f3f4f6}
.btn.primary{background:var(--primary); color:#fff; border-color:transparent}
.btn.primary:hover{filter:brightness(0.95)}

.btn.chip{
  border-radius:999px;
  padding:8px 12px;
}
.btn.chip[aria-pressed="true"]{
  background:var(--primary-weak);
  border-color:transparent;
}

.btn.icon{
  padding:6px 10px;
  line-height:1;
}

.list{
  list-style:none;
  margin:0;
  padding:0;
  display:grid;
  gap:8px;
}

.item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
}
.item:focus-within{border-color:var(--focus); box-shadow:0 0 0 4px var(--primary-weak)}

.checkbox{
  display:flex;
  align-items:center;
  gap:12px;
  flex:1;
  min-width:0;
}
.checkbox input{
  appearance:none;
  width:22px;height:22px;
  border:2px solid var(--border);
  border-radius:6px;
  display:inline-grid;
  place-items:center;
  background:#fff;
  cursor:pointer;
  position:relative;
}
.checkbox input:focus{outline:3px solid var(--primary-weak); outline-offset:2px}
.checkmark{
  position:absolute;
  width:16px;height:16px;
  border-radius:4px;
  transform:scale(0);
  transition:transform .15s ease;
  background:var(--primary);
}
.checkbox input:checked + .checkmark{transform:scale(1)}

.text{
  display:inline-block;
  padding:6px 8px;
  border-radius:8px;
  outline:none;
  min-width:1ch;
  word-break:break-word;
}
.text[contenteditable="true"]:focus{
  background:#f9fafb;
}

.item.done .text{
  color:var(--muted);
  text-decoration:line-through;
}

.footer{
  display:grid;
  gap:12px;
  margin-top:16px;
}
.progress-wrap{
  width:100%;
  height:8px;
  background:#eef2ff;
  border-radius:999px;
  overflow:hidden;
  border:1px solid var(--border);
}
.progress-bar{
  height:100%;
  width:0%;
  background:var(--primary);
  transition:width .2s ease;
}

.controls{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
}
.filters{display:flex; gap:6px}

.sr-only{
  position:absolute !important;
  width:1px;height:1px;
  padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;
}

/* Small screens */
@media (max-width:480px){
  .container{margin:24px 12px; padding:16px}
}