:root {
  --ink: #0f172a;
  --ink-soft: #475569;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --high: #dc2626;
  --med: #2563eb;
  --low: #94a3b8;
  --accent: #0f172a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
  padding-bottom: env(safe-area-inset-bottom);
}

header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.header-actions {
  display: flex;
  gap: 8px;
}
.header-actions button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
#toggle-done[aria-pressed="true"] {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

#setup, #login {
  max-width: 320px;
  margin: 32px auto 0;
}
#setup form, #login form {
  display: grid;
  gap: 8px;
}
.hint {
  color: var(--ink-soft);
  font-size: 13px;
  margin-top: 0;
}
.error {
  color: var(--high);
  font-size: 13px;
  margin: 4px 0 0;
}

main {
  padding: 16px;
  max-width: 720px;
  margin: 0 auto;
}

#add-form {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}
#add-form .add-form__row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
}

input, select, button {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, button:focus {
  outline: 2px solid var(--med);
  outline-offset: 1px;
}

button {
  cursor: pointer;
}
button[type="submit"] {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 600;
}

#tasks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 8px;
}
.task--done {
  opacity: 0.5;
}
.task--done .note {
  text-decoration: line-through;
}

.task .done {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  border: 1.5px solid var(--border);
  color: transparent;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}
.task .done:hover { color: var(--ink-soft); }
.task--done .done {
  background: var(--ink-soft);
  color: white;
  border-color: var(--ink-soft);
}

.task .note {
  flex: 1;
  word-break: break-word;
}
.task .when {
  color: var(--ink-soft);
  font-size: 12px;
  white-space: nowrap;
}
.task .when--fired { color: var(--high); }
.task .delete {
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-size: 14px;
  padding: 4px 6px;
  cursor: pointer;
  opacity: 0.5;
}
.task .delete:hover { opacity: 1; }

.prio-1 { border-left-color: var(--high); }
.prio-2 { border-left-color: var(--med); }
.prio-3 { border-left-color: var(--low); }

#tasks:empty::after {
  content: "Nothing on the list. Nice.";
  color: var(--ink-soft);
  display: block;
  padding: 24px 0;
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e2e8f0;
    --ink-soft: #94a3b8;
    --bg: #0f172a;
    --card: #1e293b;
    --border: #334155;
    --accent: #e2e8f0;
  }
  button[type="submit"] {
    background: var(--med);
    border-color: var(--med);
    color: white;
  }
  #toggle-done[aria-pressed="true"] {
    background: var(--med);
    border-color: var(--med);
  }
}
