:root {
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --border: #e2e4e9;
  --done-bg: #f0fdf4;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

h1 {
  font-size: 1.25rem;
  margin: 0;
}

button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  background: var(--primary);
  color: white;
  font-size: 0.9rem;
}

button:hover {
  background: var(--primary-hover);
}

button.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

button.secondary:hover {
  background: var(--border);
}

button.danger {
  background: var(--danger);
}

input, select {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: white;
  color: var(--text);
}

/* Auth page */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.auth-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.auth-card h1 {
  text-align: center;
  margin-bottom: 1.5rem;
}

.tabs {
  display: flex;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  background: none;
  color: var(--muted);
  border-radius: 0;
  border-bottom: 2px solid transparent;
  padding: 0.6rem;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-btn:hover {
  background: none;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-form label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

.auth-form button {
  margin-top: 1rem;
}

.hidden {
  display: none !important;
}

.error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 1rem;
  text-align: center;
}

/* App */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}

.new-task-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--card-bg);
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.new-task-form #new-title {
  flex: 2 1 200px;
}

.new-task-form #new-description {
  flex: 2 1 200px;
}

.new-task-form #new-due-date {
  flex: 1 1 140px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.filters label {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  color: var(--muted);
  gap: 0.25rem;
}

.search-label {
  flex: 1 1 180px;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.task-item.done {
  background: var(--done-bg);
}

.task-item input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 18px;
  height: 18px;
}

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

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

.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--muted);
}

.task-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.task-meta input[type="date"] {
  font-size: 0.8rem;
  padding: 0.2rem 0.4rem;
}

.task-actions {
  display: flex;
  gap: 0.4rem;
}

.task-actions button {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}

.empty-msg {
  text-align: center;
  color: var(--muted);
  margin-top: 2rem;
}
