:root {
  --bg: #0f172a;
  --bg-elev: #1e293b;
  --bg-card: #334155;
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --accent: #3b82f6;
  --accent-hot: #ef4444;
  --success: #22c55e;
  --border: #475569;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  padding-top: calc(16px + env(safe-area-inset-top));
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.actions { display: flex; gap: 8px; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--bg-card); }
.icon-btn:active { transform: scale(0.96); }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.mic-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.mic {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, var(--accent), #2563eb);
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.mic:hover { transform: scale(1.03); }
.mic:active { transform: scale(0.97); }

.mic .mic-icon { font-size: 42px; line-height: 1; }
.mic .mic-label { font-size: 13px; opacity: 0.95; }

.mic.recording {
  background: linear-gradient(145deg, var(--accent-hot), #b91c1c);
  animation: pulse 1.4s ease-in-out infinite;
}
.mic.processing {
  background: linear-gradient(145deg, #a855f7, #7e22ce);
  animation: spin-slow 2s linear infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
  50% { box-shadow: 0 0 0 22px rgba(239, 68, 68, 0); }
}
@keyframes spin-slow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.55); }
  50% { box-shadow: 0 0 0 22px rgba(168, 85, 247, 0); }
}

.status {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
}

.transcript {
  width: 100%;
  min-height: 0;
  padding: 0 12px;
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  font-size: 14px;
  word-wrap: break-word;
}
.transcript:not(:empty) {
  padding: 12px;
  background: var(--bg-elev);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.list-section { }

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  padding: 0 4px;
}

.list-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.count {
  background: var(--bg-card);
  color: var(--text);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

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

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 16px 4px 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.group-header:first-child { padding-top: 4px; }
.group-overdue .group-title { color: #fca5a5; }
.group-today .group-title { color: #93c5fd; }
.group-tomorrow .group-title { color: #93c5fd; }
.group-thisweek .group-title { color: var(--text-dim); }
.group-nextweek .group-title { color: var(--text-dim); }
.group-later .group-title { color: var(--text-dim); }
.group-nodate .group-title { color: var(--text-dim); }
.group-done .group-title { color: var(--text-dim); opacity: 0.6; }

.group-badge {
  background: var(--bg-card);
  color: var(--text-dim);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.todo-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: opacity 0.2s, transform 0.2s;
  animation: slide-in 0.25s ease;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.todo-item.done { opacity: 0.55; }
.todo-item.done .todo-text { text-decoration: line-through; }

.check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  margin-top: 2px;
}
.check:hover { border-color: var(--accent); }
.todo-item.done .check {
  background: var(--success);
  border-color: var(--success);
}
.todo-item.done .check::after {
  content: "✓";
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.todo-body { flex: 1; min-width: 0; }
.todo-text {
  font-size: 15px;
  line-height: 1.4;
  word-wrap: break-word;
}
.todo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-dim);
}
.tag.prio-high { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.tag.prio-medium { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.tag.prio-low { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.tag.date { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }

.delete {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
}
.delete:hover { opacity: 1; color: var(--accent-hot); }

.empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  padding: 30px 20px;
}
.empty.hidden { display: none; }

/* ---------- Login ---------- */
[hidden] { display: none !important; }

.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(24px + env(safe-area-inset-top));
  z-index: 50;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}

.login-icon {
  font-size: 42px;
  text-align: center;
  margin-bottom: 4px;
}

.login-card h1 {
  margin: 0;
  text-align: center;
  font-size: 22px;
}

.login-sub {
  margin: 0 0 6px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
}

.login-card input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}
.login-card input:focus { border-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  transition: filter 0.15s, transform 0.05s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
  margin: 0;
  color: #fca5a5;
  font-size: 13px;
  text-align: center;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 100;
  animation: toast-in 0.25s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
