:root {
  --bg: #1c1917;
  --card: #292524;
  --card-done: #211e1c;
  --text: #f5f5f4;
  --muted: #a8a29e;
  --accent: #f59e0b;
  --danger: #f87171;
  --ok: #4ade80;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
}
h1 { font-size: 1.3rem; margin: 0; letter-spacing: 0.02em; }
.header-actions { display: flex; gap: 8px; align-items: center; }
#whoami {
  background: var(--card);
  color: var(--text);
  border: 1px solid #44403c;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.9rem;
}
#notify-btn {
  background: var(--card);
  border: 1px solid #44403c;
  border-radius: 8px;
  font-size: 1rem;
  padding: 6px 10px;
  cursor: pointer;
}
#notify-btn.on { border-color: var(--ok); }

main {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 16px;
}
.section-title {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 18px 0 8px;
}
.task {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.task.done { background: var(--card-done); }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.check {
  width: 24px; height: 24px;
  min-width: 24px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  background: none;
  cursor: pointer;
  color: var(--ok);
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
}
.task.done .check { border-color: var(--ok); }
.task-body { flex: 1; min-width: 0; }
.title { font-size: 1rem; overflow-wrap: break-word; }
.meta { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.meta .overdue { color: var(--danger); font-weight: 600; }
.del {
  background: none; border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
}
.empty { color: var(--muted); text-align: center; margin-top: 40vh; }

footer {
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid #292524;
}
#add-form { display: flex; gap: 8px; }
#add-input {
  flex: 1;
  background: var(--card);
  border: 1px solid #44403c;
  border-radius: 24px;
  color: var(--text);
  padding: 12px 16px;
  font-size: 1rem;
  outline: none;
}
#add-input:focus { border-color: var(--accent); }
#mic-btn, #send-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  background: var(--card);
  color: var(--text);
}
#send-btn { background: var(--accent); color: #1c1917; }
#mic-btn.listening { background: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.12); } }

#toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: #f5f5f4;
  color: #1c1917;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 0.92rem;
  max-width: 86vw;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 10;
}
