/* ---------- Jetons de design ---------- */
:root {
  --bg: #0b0d12;
  --bg-elev: #12151c;
  --surface: #161a23;
  --surface-2: #1c212c;
  --border: rgba(255, 255, 255, 0.07);
  --text: #e8eaf0;
  --text-dim: #9aa1b2;
  --text-faint: #666e82;
  --accent: #7c9eff;
  --accent-dim: rgba(124, 158, 255, 0.16);
  --accent-strong: #a6bdff;
  --danger: #ff6b6b;
  --danger-dim: rgba(255, 107, 107, 0.14);
  --good: #5fe3a1;
  --good-dim: rgba(95, 227, 161, 0.14);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.28);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#root { min-height: 100%; }

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a { color: var(--accent-strong); }

/* ---------- Écran d'auth / déverrouillage ---------- */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(124, 158, 255, 0.16), transparent 55%),
    radial-gradient(circle at 80% 75%, rgba(95, 227, 161, 0.10), transparent 50%),
    var(--bg);
  background-size: 180% 180%, 180% 180%, 100% 100%;
  animation: driftBg 26s var(--ease) infinite alternate;
}

@keyframes driftBg {
  0%   { background-position: 0% 0%, 100% 100%, 0 0; }
  100% { background-position: 40% 30%, 60% 70%, 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-screen { animation: none; }
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-card);
  animation: popIn 0.42s var(--ease) both;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.auth-sub {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin: 0 0 22px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.field input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 500;
  transition: background 0.15s var(--ease), transform 0.1s var(--ease), border-color 0.15s;
}

.btn:hover { background: #222838; border-color: rgba(255,255,255,0.14); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.55; cursor: default; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5f7fe0);
  border-color: transparent;
  color: #0b0d12;
  width: 100%;
  margin-top: 6px;
}
.btn-primary:hover { filter: brightness(1.06); background: linear-gradient(135deg, var(--accent), #5f7fe0); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

.btn-danger {
  background: var(--danger-dim);
  border-color: rgba(255,107,107,0.35);
  color: #ffb3b3;
}
.btn-danger:hover { background: rgba(255,107,107,0.22); }

.auth-switch {
  margin-top: 18px;
  text-align: center;
  font-size: 0.86rem;
  color: var(--text-dim);
}
.auth-switch button { background: none; border: none; color: var(--accent-strong); padding: 0; }

.error-box {
  background: var(--danger-dim);
  border: 1px solid rgba(255,107,107,0.3);
  color: #ffb3b3;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.85rem;
  margin-bottom: 14px;
  animation: shake 0.32s var(--ease);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.spinner {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(11,13,18,0.25);
  border-top-color: #0b0d12;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Coquille de l'appli ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-title {
  font-weight: 700;
  font-size: 1.1rem;
  padding: 6px 10px 16px;
  letter-spacing: -0.01em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.92rem;
  border: none;
  background: transparent;
  text-align: left;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.is-active {
  background: var(--accent-dim);
  color: var(--accent-strong);
  font-weight: 600;
}

.nav-spacer { flex: 1; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

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

.topbar-title { font-size: 1.1rem; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 0.85rem; }

.content {
  flex: 1;
  padding: 28px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 18px;
  animation: slideIn 0.3s var(--ease) both;
}

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

.card h2 {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.task-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.task-form input[type="text"] {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
}
.task-form input[type="text"]:focus { border-color: var(--accent); }
.task-form select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
}

.task-list { display: flex; flex-direction: column; gap: 6px; }

.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  animation: popRow 0.25s var(--ease) both;
}
@keyframes popRow {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.task-row.is-done { opacity: 0.5; }
.task-row.is-done .task-text { text-decoration: line-through; }

.task-check {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--text-faint);
  background: transparent;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.task-row.is-done .task-check { background: var(--good); border-color: var(--good); }

.task-text { flex: 1; }

.task-cat {
  font-size: 0.72rem;
  color: var(--text-faint);
  background: var(--surface);
  border-radius: 999px;
  padding: 2px 9px;
}

.task-del {
  background: none; border: none; color: var(--text-faint);
  font-size: 0.85rem; opacity: 0.6;
}
.task-del:hover { color: var(--danger); opacity: 1; }

.empty-state {
  color: var(--text-faint);
  font-size: 0.88rem;
  text-align: center;
  padding: 18px 0;
}

.placeholder-card {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
}

.lock-note {
  color: var(--text-faint);
  font-size: 0.78rem;
  margin-top: 16px;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; flex-direction: row; overflow-x: auto; padding: 10px; }
  .sidebar-title { display: none; }
  .nav-spacer { display: none; }
  .nav-item { white-space: nowrap; }
}
