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

:root {
  --bg:        #f5f3ef;
  --surface:   #ffffff;
  --sidebar:   #fefefe;
  --border:    #e8e4de;
  --text:      #2d2d2d;
  --text-soft: #888;
  --accent:    #5b8dee;
  --accent-light: #ebf0fd;
  --green:     #34c77b;
  --green-light: #e8f8f0;
  --red:       #f05a5a;
  --red-light: #fdeaea;
  --yellow:    #f5a623;
  --yellow-light: #fef5e4;
  --radius:    12px;
  --shadow:    0 2px 12px rgba(0,0,0,0.07);
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-icon { font-size: 24px; }
.brand-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}
.filters {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.filter-btn:hover { background: var(--bg); color: var(--text); }
.filter-btn.active { background: var(--accent-light); color: var(--accent); }

.filter-icon { font-size: 16px; }

.badge {
  margin-left: auto;
  background: var(--border);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
}
.filter-btn.active .badge {
  background: var(--accent);
  color: #fff;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-soft);
  margin-bottom: 10px;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cat-btn {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.cat-btn:hover { border-color: var(--accent); color: var(--accent); }
.cat-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.progress-box {
  margin-top: auto;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
}
.progress-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}
.progress-bar-wrap {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #5be09b);
  border-radius: 99px;
  width: 0%;
  transition: width 0.4s ease;
}
.progress-text {
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 600;
}

.main {
  flex: 1;
  padding: 28px 36px;
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.page-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.page-sub {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 2px;
}

.add-btn {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(91,141,238,0.3);
}
.add-btn:hover { background: #4a7de2; transform: translateY(-1px); }
.add-btn:active { transform: translateY(0); }

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
}
.search-icon { font-size: 14px; }
.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 0;
  background: transparent;
  color: var(--text);
}
.search-input::placeholder { color: var(--text-soft); font-weight: 500; }

.sort-select {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  outline: none;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-emoji { font-size: 48px; margin-bottom: 12px; }
.empty-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.empty-sub { font-size: 14px; color: var(--text-soft); }

.task-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow 0.15s, transform 0.15s;
  animation: slideIn 0.2s ease;
}
.task-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.task-card.completed .task-title {
  text-decoration: line-through;
  color: var(--text-soft);
}
.task-card.completed {
  background: #fafafa;
  opacity: 0.75;
}

.task-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.15s;
}
.task-check:hover { border-color: var(--green); background: var(--green-light); }
.task-card.completed .task-check {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.task-body { flex: 1; min-width: 0; }

.task-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.3;
}
.task-notes {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 8px;
  line-height: 1.4;
}

.task-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}

.tag-cat { background: var(--accent-light); color: var(--accent); }
.tag-work    { background: #eef1fb; color: #4a6fcc; }
.tag-personal{ background: #fef0f8; color: #cc4a99; }
.tag-health  { background: var(--green-light); color: #2a9e5f; }
.tag-shopping{ background: #fff5e6; color: #d08020; }

.tag-priority-low    { background: var(--green-light);  color: #2a9e5f; }
.tag-priority-medium { background: var(--yellow-light); color: var(--yellow); }
.tag-priority-high   { background: var(--red-light);    color: var(--red); }

.tag-due { background: var(--bg); color: var(--text-soft); }
.tag-due.overdue { background: var(--red-light); color: var(--red); }

.task-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.task-card:hover .task-actions { opacity: 1; }

.action-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.12s;
  line-height: 1;
}
.action-btn:hover { background: var(--bg); }
.action-btn.delete:hover { background: var(--red-light); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border-radius: 18px;
  padding: 28px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
  transform: translateY(12px);
  transition: transform 0.2s;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 18px; font-weight: 800; }
.modal-close {
  border: none;
  background: var(--bg);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-soft);
  font-weight: 700;
  transition: background 0.12s;
}
.modal-close:hover { background: var(--red-light); color: var(--red); }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 700; color: var(--text-soft); }
.form-input {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--accent); background: #fff; }
.form-textarea { resize: vertical; min-height: 72px; }

.form-row { display: flex; gap: 12px; }
.form-group.half { flex: 1; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

.btn-cancel {
  padding: 10px 18px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.12s;
}
.btn-cancel:hover { background: var(--bg); }

.btn-save {
  padding: 10px 22px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: background 0.12s;
  box-shadow: 0 2px 8px rgba(91,141,238,0.3);
}
.btn-save:hover { background: #4a7de2; }

@media (max-width: 700px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; gap: 16px; padding: 18px; border-right: none; border-bottom: 1px solid var(--border); }
  .progress-box { margin-top: 0; }
  .main { padding: 20px 18px; }
  .task-actions { opacity: 1; }
}
