/* Maxxweb Todo — flat design clair, accent teal, CTA orange. Mobile-first. */
:root {
  --bg: #F8FAF9;
  --surface: #FFFFFF;
  --border: #E2E8E6;
  --text: #10322E;
  --muted: #5B6B68;
  --primary: #0D9488;
  --primary-soft: #CCFBF1;
  --cta: #F97316;
  --danger: #DC2626;
  --overdue: #B91C1C;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 50, 46, .07);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 1px;
}
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 32px 28px; width: 360px; max-width: 100%; box-shadow: var(--shadow);
}
.login-logo { margin-bottom: 12px; }
.login-card h1 { font-size: 22px; margin: 0; }
.login-sub { color: var(--muted); font-size: 14px; margin: 4px 0 8px; }
.login-error { background: #FEF2F2; color: var(--danger); border-radius: 8px; padding: 9px 12px; font-size: 14px; margin-top: 8px; }
.login-card button {
  margin-top: 18px; width: 100%; padding: 13px; border: 0; border-radius: 10px;
  background: var(--primary); color: #fff; font-size: 16px; font-weight: 700;
  transition: background .2s;
}
.login-card button:hover { background: #0B7E74; }

/* ---------- Layout app ---------- */
.app {
  max-width: 640px; margin: 0 auto; min-height: 100vh;
  padding: 0 16px calc(96px + env(safe-area-inset-bottom));
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0 8px;
}
.topbar h1 { font-size: 26px; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.topbar-date { color: var(--muted); font-size: 13px; font-weight: 500; text-transform: capitalize; }
.icon-btn {
  background: none; border: 0; color: var(--muted); padding: 10px; border-radius: 10px;
  min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); }

.offline-banner {
  background: #FFF7ED; color: #9A3412; border: 1px solid #FED7AA;
  border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 600; margin-bottom: 8px;
}

/* ---------- Tabs & chips ---------- */
.tabs { display: flex; gap: 4px; background: #EDF2F0; border-radius: 12px; padding: 4px; margin: 6px 0 10px; }
.tab {
  flex: 1; border: 0; background: none; padding: 9px 4px; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--muted); transition: background .15s, color .15s;
  min-height: 40px;
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600;
  white-space: nowrap; transition: background .15s, color .15s, border-color .15s;
  min-height: 36px;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .count { opacity: .65; font-weight: 500; margin-left: 4px; }

/* ---------- Liste ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.group-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 10px 2px 2px; }
.group-label.overdue { color: var(--overdue); }
.task {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer; transition: border-color .15s, transform .15s, opacity .2s;
}
.task:hover { border-color: var(--primary); }
.task.done-anim { opacity: 0; transform: translateX(24px); }
.check {
  flex: none; width: 26px; height: 26px; margin-top: 1px;
  border: 2px solid #B8C6C2; border-radius: 999px; background: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent; transition: background .15s, border-color .15s, color .15s;
  padding: 0;
}
.check:hover { border-color: var(--primary); }
.task.is-done .check, .check.checked { background: var(--primary); border-color: var(--primary); color: #fff; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 15.5px; overflow-wrap: anywhere; }
.task.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; align-items: center; }
.badge {
  font-size: 11.5px; font-weight: 600; border-radius: 6px; padding: 2px 7px;
  background: #EDF2F0; color: var(--muted);
}
.badge.project { background: var(--primary-soft); color: #0B6B62; }
.badge.due { background: #EFF6FF; color: #1D4ED8; }
.badge.due.overdue { background: #FEF2F2; color: var(--overdue); }
.badge.prio1 { background: #FEF9C3; color: #854D0E; }
.badge.prio2 { background: #FFEDD5; color: #C2410C; }
.badge.src { background: #F3F0FF; color: #6D28D9; }
.badge.repeat { background: #ECFEFF; color: #0E7490; }
.task-note { color: var(--muted); font-size: 13px; margin-top: 3px; overflow-wrap: anywhere; }
.empty {
  text-align: center; color: var(--muted); padding: 48px 16px; font-size: 15px;
}
.empty strong { display: block; font-size: 17px; color: var(--text); margin-bottom: 4px; }

/* ---------- Barre d'ajout ---------- */
.add-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 640px; margin: 0 auto;
  display: flex; gap: 8px; align-items: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 75%, transparent);
}
.add-bar input {
  flex: 1; border-radius: 999px; padding: 13px 18px; box-shadow: var(--shadow);
}
.add-btn {
  flex: none; width: 50px; height: 50px; border-radius: 999px; border: 0;
  background: var(--cta); color: #fff; display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s; box-shadow: var(--shadow);
}
.add-btn:hover { background: #EA580C; }
.add-bar .icon-btn { background: var(--surface); border: 1px solid var(--border); }

/* ---------- Sheets ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(16, 50, 46, .35); z-index: 40;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-width: 640px; margin: 0 auto;
  background: var(--surface); border-radius: 18px 18px 0 0;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 40px rgba(16, 50, 46, .18);
  animation: slide-up .22s ease;
}
@keyframes slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .sheet { animation: none; }
  .task, .tab, .chip, .check { transition: none; }
}
.sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: var(--border); margin: 4px auto 10px; }
.sheet h2 { font-size: 18px; margin: 0 0 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.repeat-row { display: grid; grid-template-columns: 70px 1fr; gap: 6px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 20px; }
.btn-primary {
  flex: 1; border: 0; border-radius: 10px; padding: 13px; background: var(--primary);
  color: #fff; font-weight: 700; font-size: 15px; transition: background .15s;
}
.btn-primary:hover { background: #0B7E74; }
.btn-danger {
  border: 1px solid #FECACA; background: #FEF2F2; color: var(--danger);
  border-radius: 10px; padding: 13px 16px; font-weight: 600; transition: background .15s;
}
.btn-danger:hover { background: #FEE2E2; }
.btn-secondary {
  width: 100%; border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; padding: 13px; font-weight: 600; font-size: 15px; color: var(--text);
  transition: background .15s; margin-top: 10px;
}
.btn-secondary:hover { background: var(--primary-soft); }
.btn-ghost {
  width: 100%; border: 0; background: none; color: var(--muted); padding: 13px;
  font-weight: 600; margin-top: 14px; border-radius: 10px; transition: color .15s;
}
.btn-ghost:hover { color: var(--danger); }
.settings-hint { font-size: 13px; color: var(--muted); margin: 6px 2px 0; }
.settings-version { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
.settings-body { padding-top: 6px; }

/* ---------- Snackbar ---------- */
.snackbar {
  position: fixed; bottom: calc(86px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; border-radius: 10px; padding: 11px 16px;
  font-size: 14px; font-weight: 600; z-index: 60; display: flex; gap: 14px; align-items: center;
  box-shadow: 0 6px 24px rgba(16, 50, 46, .25); max-width: 90vw;
}
.snackbar button { background: none; border: 0; color: #5EEAD4; font-weight: 700; font-size: 14px; padding: 2px 4px; }

@media (min-width: 768px) {
  .topbar h1 { font-size: 30px; }
  .sheet { bottom: auto; top: 50%; left: 50%; right: auto; transform: translate(-50%, -50%); width: 480px; border-radius: 18px; }
  @keyframes slide-up { from { transform: translate(-50%, -46%); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
}
