* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
  background: #f5f6f8;
  color: #222;
}

.container {
  max-width: 640px;
  margin: 40px auto;
  padding: 0 16px;
}

h1 {
  margin-bottom: 24px;
}

h2 {
  font-size: 1.1rem;
  margin-top: 32px;
}

.count {
  color: #666;
  font-weight: normal;
}

.task-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.task-form input,
.task-form select,
.task-form textarea,
.filter-bar input,
.filter-bar select {
  padding: 8px 10px;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
}

.task-form #task-title {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
}

.task-form textarea,
.task-edit textarea {
  width: 100%;
  resize: vertical;
}

.task-form button {
  padding: 10px 18px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  background: #2f6fed;
  color: #fff;
  cursor: pointer;
}

.task-form button:hover {
  background: #2459c4;
}

.task-form input:disabled,
.task-form select:disabled,
.task-form textarea:disabled,
.task-form button:disabled {
  background: #e0e0e0;
  color: #888;
  cursor: not-allowed;
}

.form-error {
  min-height: 1.2em;
  margin: 8px 0 0;
  color: #c62828;
  font-size: 0.9rem;
}

.empty-message {
  color: #888;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.task-list li {
  padding: 12px 14px;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid #e2e4e8;
  border-radius: 6px;
  overflow-wrap: anywhere;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.filter-bar input {
  flex: 1;
  min-width: 160px;
}

.task-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.task-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-info {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-weight: 600;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.badge {
  padding: 2px 8px;
  font-size: 0.8rem;
  border-radius: 999px;
  background: #eef0f3;
  color: #444;
}

.badge.priority-high {
  background: #fde8e8;
  color: #b42318;
}

.badge.priority-low {
  background: #eef4ff;
  color: #3555a5;
}

.badge.overdue-badge {
  background: #c62828;
  color: #fff;
  font-weight: 600;
}

.task-list li.overdue {
  border-left: 4px solid #c62828;
}

.task-description {
  margin: 8px 0 0;
  color: #555;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.task-actions {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}

.task-edit input,
.task-edit textarea,
.task-edit select {
  font-family: inherit;
  padding: 6px 8px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.task-list button,
.task-list select {
  padding: 4px 10px;
  font-size: 0.9rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.task-list button:hover {
  background: #f0f0f0;
}

.task-list li.done .task-title {
  color: #888;
  text-decoration: line-through;
}

@media (max-width: 480px) {
  .task-main {
    flex-direction: column;
    align-items: stretch;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
