:root {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-2: #20242d;
  --border: #2a2f3a;
  --text: #e8ebf0;
  --muted: #8b94a3;
  --primary: #6366f1;
  --primary-hover: #4f51d8;
  --danger: #ef4444;
  --success: #10b981;
  --radius: 10px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8fb;
    --surface: #ffffff;
    --surface-2: #f0f2f7;
    --border: #e3e6ed;
    --text: #1a1d24;
    --muted: #6b7280;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.3px;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

label {
  display: block;
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.8rem;
  font-size: 1rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}

input:focus {
  border-color: var(--primary);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

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

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

button.ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

button.link {
  background: transparent;
  color: var(--primary);
  padding: 0;
  font: inherit;
  border: none;
}

button.link:hover:not(:disabled) {
  background: transparent;
  text-decoration: underline;
}

#authForm button[type="submit"] {
  width: 100%;
  margin-top: 0.25rem;
}

.add-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.add-form input {
  flex: 1;
}

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

.todo-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.todo-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.todo-item .title {
  flex: 1;
  word-break: break-word;
}

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

.todo-item .delete {
  background: transparent;
  color: var(--muted);
  padding: 0.3rem 0.5rem;
  font-size: 1.1rem;
  line-height: 1;
}

.todo-item .delete:hover {
  background: transparent;
  color: var(--danger);
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.muted a {
  color: var(--primary);
  text-decoration: none;
}

.muted a:hover {
  text-decoration: underline;
}

.msg {
  min-height: 1.2em;
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
}

.msg.error {
  color: var(--danger);
}

.msg.success {
  color: var(--success);
}

.hidden {
  display: none !important;
}
