/* TodoList — styles */
:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #4B5563;
  --faint: #6B7280;
  --line: #E5E7EB;
  --line-2: #D1D5DB;
  --accent: #2747C9;
  --accent-ink: #1C369A;
  --accent-soft: #E8EDFC;
  --warn: #B4410E;
  --warn-soft: #FDEEE4;
  --warn-line: #F3C9AE;
  --radius: 14px;
  --nav-h: 78px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --display: 'Space Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(39, 71, 201, .45); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.splash { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.splash img { border-radius: 18px; }

.screen {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 24px) 20px calc(var(--nav-h) + var(--safe-b) + 32px);
  min-height: 100vh;
}
.screen.no-nav { padding-bottom: calc(var(--safe-b) + 32px); }

/* ---------- En-têtes ---------- */
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.head-l { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
h1, .h1 { margin: 0; font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.h1-sm { font-size: 26px; }
h2 { margin: 0; font-size: 15px; font-weight: 700; }
.date-title { position: relative; display: inline-block; cursor: pointer; }
.date-title input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }

.icon-btn {
  position: relative; flex: none;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; padding: 0;
}
.icon-btn:hover { color: var(--ink); background: #FAFAFB; }
.icon-btn.round { border-radius: 14px; }
.badge {
  position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg);
}
.arrows { display: flex; gap: 6px; }

.seg { display: flex; background: var(--line); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 16px; }
.seg a { flex: 1; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; color: var(--ink-2); text-decoration: none; }
.seg a.on { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* ---------- Bande des jours ---------- */
.strip { display: flex; gap: 6px; margin: 4px -4px 14px; }
.strip button {
  flex: 1; min-width: 0; height: 62px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); padding: 0; position: relative;
}
.strip .dn { font-size: 11px; font-weight: 500; }
.strip .dd { font-size: 17px; font-weight: 600; color: var(--ink); }
.strip button.today:not(.sel) { border: 2px solid var(--accent); }
.strip button.sel { background: var(--accent); border-color: var(--accent); color: #fff; }
.strip button.sel .dd { color: #fff; font-weight: 700; }
.strip .dot { position: absolute; bottom: 6px; width: 4px; height: 4px; border-radius: 2px; background: var(--accent); }
.strip button.sel .dot { background: #fff; }

.back-today { display: inline-flex; margin: -6px 0 12px; font-size: 13px; font-weight: 600; text-decoration: none; background: var(--accent-soft); color: var(--accent-ink); border: none; border-radius: 10px; padding: 7px 12px; }

/* ---------- Résumé ---------- */
.stats { display: flex; gap: 8px; margin-bottom: 16px; }
.stat { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); }
.stat b { font-family: var(--display); font-size: 20px; font-weight: 700; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.stat.warn span { color: var(--warn); font-weight: 600; }

/* ---------- Tâches ---------- */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 12px; align-items: stretch; }
.times { width: 44px; flex: none; display: flex; flex-direction: column; font-size: 12px; color: var(--muted); padding-top: 12px; font-variant-numeric: tabular-nums; }
.times b { color: var(--ink); font-weight: 600; }
.card {
  flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; display: flex; align-items: center; gap: 10px;
}
.card.late { background: var(--warn-soft); border-color: transparent; }
.card.soon, .card.now { border: 2px solid var(--accent); padding: 9px 11px; }
.check {
  flex: none; width: 28px; height: 28px; border-radius: 8px; border: 2px solid #9CA3AF; background: var(--surface);
  display: flex; align-items: center; justify-content: center; padding: 0; color: #fff;
}
.card.late .check { border-color: var(--warn); }
.check.on { background: var(--accent); border-color: var(--accent); }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); }
.card-body:hover { color: var(--ink); }
.t-title { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.t-sub { font-size: 12px; color: var(--muted); }
.card.done .t-title { text-decoration: line-through; color: var(--muted); }
.card.late .t-sub { color: var(--warn); font-weight: 600; }
.pill { flex: none; font-size: 11px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); border-radius: 8px; padding: 4px 8px; white-space: nowrap; }
.pill.warn { color: var(--warn); background: #fff; }

.now-line { display: flex; align-items: center; gap: 8px; padding-left: 48px; }
.now-line i { width: 8px; height: 8px; border-radius: 4px; background: var(--accent); }
.now-line span { flex: 1; height: 2px; background: var(--accent); }
.now-line b { font-size: 11px; font-weight: 700; color: var(--accent); }

.empty { text-align: center; padding: 28px 16px; background: var(--surface); border: 1px dashed var(--line-2); border-radius: 16px; color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.empty p { margin: 0; font-size: 14px; }

/* ---------- Boutons ---------- */
.btn {
  height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn:hover { color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.primary:hover { background: var(--accent-ink); color: #fff; }
.btn.danger { color: var(--warn); border-color: var(--warn-line); }
.btn.sm { height: 40px; font-size: 13px; border-radius: 10px; padding: 0 12px; }
.btn.block { width: 100%; }
.link-btn { background: none; border: none; padding: 6px 0; font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; }

/* ---------- Semaine ---------- */
.week { display: flex; flex-direction: column; gap: 12px; }
.day-box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.day-box.today { border: 2px solid var(--accent); padding: 11px 13px; }
.day-box.today h2 { color: var(--accent); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; background: none; border: none; padding: 0; text-align: left; color: inherit; width: 100%; }
.day-head span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.w-item { display: flex; gap: 10px; font-size: 13px; align-items: center; text-decoration: none; color: var(--ink); min-height: 24px; }
.w-item .tm { width: 44px; flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.w-item .tt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.w-item.done .tt { text-decoration: line-through; color: var(--muted); }
.w-item.late .tm { color: var(--warn); font-weight: 600; }
.w-item .lt { font-size: 11px; font-weight: 700; color: var(--warn); }
.w-item svg { color: var(--muted); flex: none; }
.free-box { border: 1px dashed #9CA3AF; border-radius: 16px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.free-box span { font-size: 14px; font-weight: 600; color: var(--muted); }
.free-box .link-btn { white-space: nowrap; flex: none; }

/* ---------- Mois ---------- */
.month { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 10px; }
.mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.mgrid.wd { font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; padding-bottom: 6px; }
.mcell {
  height: 44px; border: none; background: none; border-radius: 12px; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 14px; color: var(--ink);
}
.mcell i { width: 5px; height: 5px; border-radius: 3px; }
.mcell.has i { background: var(--accent); }
.mcell.has { font-weight: 600; }
.mcell.out { color: var(--faint); font-weight: 400; }
.mcell.out.has i { background: #9CA3AF; }
.mcell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.mcell.sel { background: var(--accent); color: #fff; font-weight: 700; box-shadow: none; }
.mcell.sel i { background: #fff; }
.mcell.late-day i { background: var(--warn); }
.sel-day { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.sel-head { display: flex; justify-content: space-between; align-items: baseline; }
.mini { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: flex; gap: 10px; font-size: 13px; text-decoration: none; color: var(--ink); }
.mini .tm { width: 84px; flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.mini.late .tm { color: var(--warn); font-weight: 600; }
.mini.done span:last-child { text-decoration: line-through; color: var(--muted); }
.more { font-size: 12px; color: var(--muted); }

/* ---------- Année ---------- */
.ygrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ytile {
  height: 74px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  padding: 10px 12px; display: flex; flex-direction: column; justify-content: space-between; text-align: left;
}
.ytile b { font-size: 14px; font-weight: 600; }
.ytile span { font-size: 12px; color: var(--muted); }
.ytile.cur { background: var(--accent); border-color: var(--accent); color: #fff; }
.ytile.cur b { font-weight: 700; }
.ytile.cur span { color: #fff; }
.goals { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.goal { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; gap: 10px; align-items: center; }
.goal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; background: none; border: none; padding: 0; text-align: left; color: inherit; }
.goal-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.goal-top b { font-weight: 600; overflow-wrap: anywhere; }
.goal-top span { color: var(--muted); white-space: nowrap; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 6px; border-radius: 3px; background: var(--accent); }
.plus1 { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; font-size: 13px; color: var(--accent-ink); }

/* ---------- Recherche ---------- */
.search-box { height: 50px; border-radius: 14px; background: var(--surface); border: 2px solid var(--accent); display: flex; align-items: center; gap: 10px; padding: 0 14px; margin: 14px 0; color: var(--muted); }
.search-box input { flex: 1; min-width: 0; border: none; outline: none; font-size: 16px; color: var(--ink); background: transparent; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 13px; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.results { display: flex; flex-direction: column; gap: 10px; }
.group-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; padding-top: 6px; }
.group-label.warn { color: var(--warn); }
.group-label.acc { color: var(--accent); }
.res { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); }
.res:hover { color: var(--ink); }
.res .t-title { font-size: 14px; }
.res.late { background: var(--warn-soft); border-color: transparent; }
.res.late .t-sub { color: var(--warn); font-weight: 600; }
.res.done .t-title { color: var(--muted); }
mark { background: var(--accent-soft); color: var(--accent-ink); border-radius: 3px; padding: 0; }
.res.late mark { background: #fff; color: var(--warn); }

/* ---------- Formulaire ---------- */
.form-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.form-head h1 { font-size: 20px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.field input, .field select, .field textarea {
  height: 48px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 14px;
  font-size: 15px; font-weight: 500; color: var(--ink); width: 100%; min-width: 0; -webkit-appearance: none; appearance: none;
}
.field select { padding: 0 10px; background-image: linear-gradient(45deg, transparent 50%, #4B5563 50%), linear-gradient(135deg, #4B5563 50%, transparent 50%); background-position: calc(100% - 16px) 21px, calc(100% - 11px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 26px; }
.field textarea { height: 84px; padding: 12px 14px; resize: vertical; line-height: 1.4; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(39,71,201,.15); }
.row3 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cats { display: flex; gap: 8px; flex-wrap: wrap; }
.cat { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 13px; }
.cat.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.cat.add { width: 36px; padding: 0; border-style: dashed; border-color: #9CA3AF; background: transparent; font-size: 18px; color: var(--ink-2); }
.rems { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.rem { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; min-height: 56px; border-bottom: 1px solid #F0F1F3; }
.rem:last-child { border-bottom: none; }
.rem div { display: flex; flex-direction: column; gap: 2px; }
.rem b { font-size: 14px; font-weight: 600; }
.rem small { font-size: 12px; color: var(--muted); }
.switch { flex: none; width: 50px; height: 30px; border-radius: 15px; border: none; background: #9CA3AF; padding: 3px; display: flex; justify-content: flex-start; transition: background .15s; }
.switch span { width: 24px; height: 24px; border-radius: 12px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch[aria-checked="true"] { background: var(--accent); justify-content: flex-end; }
.legend { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.err { background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; border-radius: 12px; padding: 10px 12px; }
.actions { display: flex; gap: 10px; padding-top: 4px; }
.actions .btn { flex: 1; height: 52px; }
.actions .btn.primary { flex: 2; }

/* ---------- Alertes ---------- */
.alerts { display: flex; flex-direction: column; gap: 10px; }
.notice { background: var(--ink); color: #fff; border-radius: 16px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.notice p { flex: 1; margin: 0; font-size: 13px; line-height: 1.4; }
.notice .btn { height: 36px; border-radius: 10px; font-size: 13px; padding: 0 12px; border: none; }
.notice.soft { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.al { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.al.late { border-color: var(--warn-line); }
.al-top { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--ink); }
.al-top:hover { color: var(--ink); }
.al-top > svg { flex: none; color: var(--muted); }
.al.late .al-top > svg { color: var(--warn); }
.al.soon .al-top > svg { color: var(--accent); }
.al-top div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.al.late .t-sub { color: var(--warn); font-weight: 600; }
.al-actions { display: flex; gap: 8px; }
.al-actions .btn { flex: 1; }
.none { font-size: 13px; color: var(--muted); padding: 2px 2px 6px; }
.settings { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 14px; border-bottom: 1px solid #F0F1F3; width: 100%; background: none; border-left: none; border-right: none; border-top: none; text-align: left; color: var(--ink); font-size: 14px; text-decoration: none; min-height: 52px; }
.set-row:last-child { border-bottom: none; }
.set-row svg { flex: none; color: var(--muted); }
.set-row span { flex: 1; }
.set-row small { color: var(--muted); font-size: 12px; }
.set-row.danger { color: var(--warn); }
.set-row.danger svg { color: var(--warn); }
.sync-dot { width: 8px; height: 8px; border-radius: 4px; background: #9CA3AF; flex: none; margin: 0 7px; }
.sync-dot.ok { background: var(--accent); }
.sync-dot.off { background: var(--warn); }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(255,255,255,.97); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.nav-in { max-width: 520px; margin: 0 auto; height: var(--nav-h); display: flex; align-items: center; justify-content: space-around; padding: 0 6px; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 64px; padding: 6px 0; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 500; }
.nav a.on { color: var(--accent); font-weight: 700; }
.nav a.fab { min-width: 0; width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: #fff; justify-content: center; margin-top: -26px; box-shadow: 0 8px 20px rgba(39,71,201,.35); padding: 0; }

/* ---------- Feuille (objectifs, mot de passe) ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 520px; margin: 0 auto;
  background: var(--bg); border-radius: 22px 22px 0 0; padding: 18px 20px calc(var(--safe-b) + 20px);
  display: flex; flex-direction: column; gap: 14px; max-height: 92vh; overflow: auto;
}
.sheet h2 { font-family: var(--display); font-size: 20px; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: -6px auto 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Connexion ---------- */
.auth { max-width: 400px; margin: 0 auto; min-height: 100vh; padding: calc(var(--safe-t) + 48px) 24px 32px; display: flex; flex-direction: column; gap: 18px; justify-content: center; }
.auth img { border-radius: 18px; }
.auth p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.auth form { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Bannières ---------- */
.install { background: var(--accent-soft); border-radius: 16px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.install p { flex: 1; margin: 0; font-size: 13px; color: var(--accent-ink); font-weight: 500; line-height: 1.4; }
.install .btn { height: 36px; font-size: 13px; border-radius: 10px; padding: 0 12px; }
.install .x { width: 32px; height: 32px; border: none; background: none; color: var(--accent-ink); padding: 0; display: flex; align-items: center; justify-content: center; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); transform: translate(-50%, 20px);
  max-width: min(480px, calc(100% - 32px)); width: max-content; z-index: 60;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 16px; font-size: 14px; line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  display: flex; gap: 10px; align-items: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.alarm { background: var(--accent); }

@media (min-width: 700px) {
  body { background: #ECEEF2; }
  .screen { background: var(--bg); box-shadow: 0 0 0 1px var(--line); }
}
