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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.app {
  width: 100%;
  max-width: 540px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 1.5rem;
  align-self: flex-start;
}

header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

header h1 {
  font-size: 1.5rem;
  flex: 1;
}

.mode-toggle {
  display: flex;
  gap: 0.25rem;
}

.mode-btn {
  padding: 0.3rem 0.7rem;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.mode-btn.active {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}

.status-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  font-weight: 600;
}

.status-badge.online {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.offline {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge.syncing {
  background: #fef9c3;
  color: #854d0e;
}

.todo-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.todo-form input {
  flex: 1;
  padding: 0.65rem 0.8rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.todo-form input:focus {
  border-color: #4f46e5;
}

.todo-form button {
  width: 44px;
  height: 44px;
  border: none;
  background: #4f46e5;
  color: #fff;
  font-size: 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.todo-form button:hover {
  background: #4338ca;
}

.filters {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.filter-btn {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.filter-btn.active {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}

.todo-list {
  list-style: none;
  margin-bottom: 1rem;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #f0f0f0;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.todo-item:last-child {
  border-bottom: none;
}

.todo-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #4f46e5;
  cursor: pointer;
  flex-shrink: 0;
}

.todo-item .todo-text {
  flex: 1;
  font-size: 0.95rem;
  word-break: break-word;
}

.todo-item .todo-text.completed {
  text-decoration: line-through;
  color: #999;
}

.todo-item .delete-btn {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 0.2rem;
  transition: color 0.2s;
}

.todo-item .delete-btn:hover {
  color: #ef4444;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #666;
}

.clear-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.clear-btn:hover {
  background: #fee2e2;
}

.empty-message {
  text-align: center;
  padding: 2rem 0;
  color: #aaa;
  font-size: 0.9rem;
}