/* Minas — palette « Cité Blanche » (bleu nuit de Gondor + argent + acier). */
:root {
  --bg:        #0e1524;
  --bg-2:      #121a2c;
  --surface:   #151d31;
  --surface-2: #1d2740;
  --border:    #2b3856;
  --border-strong: #526aa3;  /* contour des contrôles interactifs (contraste AA ≥ 3:1) */
  --text:      #eef2fa;
  --muted:     #8f9ab4;
  --silver:    #dbe4f5;   /* l'Arbre Blanc */
  --accent:    #6f9fd8;   /* acier lumineux */
  --accent-2:  #5a86c4;
  --green:     #5bbf83;
  --red:       #df6e80;   /* éclairci pour passer WCAG AA sur les cartes */
  --amethyst:  #9b8fd4;
  --gold:      #d8c98f;   /* touche discrète (étoiles) */
  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 10px 30px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }

/* Icônes SVG (trait fin, monochrome, teintées par currentColor). */
.icn { width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icn.lg { width: 20px; height: 20px; vertical-align: -4px; }
.icn.fill { fill: currentColor; stroke: none; }             /* étoile priorité active, play/pause */
.icn-accent { color: var(--accent); }
.icn-muted  { color: var(--muted); }
.icn-red    { color: var(--red); }
.icn-gold   { color: var(--gold); }
.icn-silver { color: var(--silver); }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 70% -10%, #17203a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 700; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--bg-2);
  border-right: 1px solid var(--border); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; }
.brand img { width: 40px; height: 40px; border-radius: 10px; }
.brand .name { font-family: Georgia, serif; font-size: 22px; letter-spacing: 3px; color: var(--silver); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); cursor: pointer; font-size: 14px; font-weight: 600; border: 1px solid transparent;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--silver); border-color: var(--border); }
.nav-item .ico { width: 20px; text-align: center; }
.sidebar .spacer { flex: 1; }

.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 26px; }

/* Cards & grid */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 12px; font-size: 16px; color: var(--text); }

/* Forms */
label.field { display: block; margin-bottom: 12px; }
label.field .lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .4px; }
input, select, textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 80px; resize: vertical; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; flex-wrap: wrap; }
.seg button { background: transparent; border: none; color: var(--muted); padding: 8px 14px; cursor: pointer; font-weight: 600; }
.seg button.active { background: var(--surface-2); color: var(--silver); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); padding: 9px 16px; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; font-size: 14px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: #08101f; border-color: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: var(--red); background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: 13px; }

/* Chips */
.chip { font-size: 12.5px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.chip.perso { color: var(--amethyst); border-color: var(--amethyst); }
.chip.shared { color: var(--accent); border-color: var(--accent-2); }

/* Semaine (tableau 7 jours) */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; }
.day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 130px; display: flex; flex-direction: column; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.day-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.day-h .dow { font-weight: 700; font-size: 13px; text-transform: capitalize; }
.day-h .dom { color: var(--muted); font-size: 12px; }
.day .add { color: var(--muted); font-size: 12px; cursor: pointer; margin-top: auto; padding-top: 8px; }
.day .add:hover { color: var(--accent); }

/* En retard (jours passés avec tâches non faites) */
.overdue-card { border-color: var(--red); box-shadow: 0 0 0 1px rgba(217,85,107,.35); }
.overdue-day { margin-top: 10px; }
.overdue-day:first-of-type { margin-top: 6px; }
.overdue-day .od-h { font-size: 12px; font-weight: 700; color: var(--red); text-transform: capitalize; margin-bottom: 2px; }

/* Ligne de tâche */
.task { display: flex; align-items: flex-start; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--border); }
.task:last-of-type { border-bottom: none; }
.task .body { flex: 1; min-width: 0; }
.task .t-title { font-size: 15px; font-weight: 600; line-height: 1.3; word-break: break-word; }
.task .t-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.task .acts { display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.task:hover .acts { opacity: 1; }
.k-ico { font-size: 14px; }

/* Case à cocher ronde */
.check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); background: transparent; cursor: pointer; flex-shrink: 0; margin-top: 1px; display: inline-flex; align-items: center; justify-content: center; color: transparent; font-size: 12px; }
.check:hover { border-color: var(--accent); }
.check.on { background: var(--green); border-color: var(--green); color: #08101f; }

/* Items (liste de courses) */
.items { margin: 8px 0 0; display: flex; flex-direction: column; gap: 2px; }
.item { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.item .check { width: 17px; height: 17px; border-radius: 5px; }
.item.on .lbl { text-decoration: line-through; color: var(--muted); }
.item .lbl { flex: 1; font-size: 13px; }
.item .x { color: var(--muted); cursor: pointer; opacity: 0; }
.item:hover .x { opacity: 1; }
/* Bouton « + » d'ajout d'une suggestion « À racheter » (pas une case à cocher) */
.add-sug { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--accent-2); color: var(--accent); background: transparent; cursor: pointer; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1; padding: 0; }
.add-sug:hover { background: var(--accent); color: #08101f; border-color: var(--accent); }

/* Calendrier */
.cal-day { margin-bottom: 6px; }
.cal-day .cal-h { font-weight: 700; font-size: 14px; text-transform: capitalize; margin: 14px 0 6px; color: var(--silver); }
.cal-ev { display: flex; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); margin-bottom: 6px; }
.cal-ev .time { color: var(--accent); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 92px; }
.cal-ev .allday { color: var(--gold); }
.cal-ev .sum { font-size: 14px; }
.cal-ev .loc { color: var(--muted); font-size: 12px; }

/* Événements Google compacts dans la grille Semaine (vue unifiée) */
.wk-ev { display: flex; gap: 6px; align-items: baseline; font-size: 11px; padding: 3px 6px; margin-bottom: 4px; border-radius: 8px; background: var(--bg-2); border-left: 2px solid var(--accent); }
.wk-ev-t { color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wk-ev-t.allday { color: var(--gold); }
.wk-ev-s { color: var(--silver); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Fiche tâche : rangée de report « Repousser à » */
.snooze-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.snooze-custom { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.snooze-custom input { width: 54px; }
.modal h2.done .k-ico { opacity: .6; }
.modal h2.done { text-decoration: line-through; color: var(--muted); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(6,9,16,0.7); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; max-width: 480px; padding: 22px; max-height: 90vh; overflow: auto; }
.modal h2 { margin: 0 0 16px; font-size: 20px; color: var(--silver); }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* Auth / onboarding */
.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; text-align: center; }
.auth-card img { width: 96px; height: 96px; border-radius: 22px; margin-bottom: 10px; box-shadow: var(--shadow); }
.auth-card .name { font-family: Georgia, serif; font-size: 30px; letter-spacing: 4px; color: var(--silver); margin-bottom: 4px; }
.auth-card .tagline { color: var(--muted); margin-bottom: 24px; }

.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: none; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.row .sub { color: var(--muted); font-size: 12px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--border); color: var(--text); padding: 12px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow); z-index: 100; }
.toast.err { border-color: var(--red); color: #ffd7dd; }
.empty { color: var(--muted); text-align: center; padding: 30px; }

/* Responsive */
@media (max-width: 980px) {
  .week { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; overflow-x: auto; padding: 10px; }
  .sidebar .brand { display: none; }
  .sidebar .spacer { display: none; }
  .nav-item { white-space: nowrap; }
  .main { padding: 18px 16px 80px; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .week { grid-template-columns: 1fr; }
}

/* Heure sur une tâche (badge neutre teinté acier). */
.chip.time { color: var(--accent); border-color: var(--accent-2); }

/* Bloc « Répéter » dans la modale tâche. */
.repeat-box { border: 1px solid var(--border); background: var(--bg-2); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; }

/* Sélecteur de jours de la semaine (récurrence hebdo). */
.dow-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.dow-picker button {
  width: 34px; height: 34px; border-radius: 999px; cursor: pointer; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--silver);
}
.dow-picker button.on { background: var(--accent-2); border-color: var(--accent); color: #fff; }

/* Suivi d'habitudes (cartes « J'ai fait » horodatées). */
.tracker-list { display: flex; flex-direction: column; gap: 10px; }
.tracker-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
}
.tracker-card .tr-icon { font-size: 26px; line-height: 1; flex-shrink: 0; }
.tracker-card .tr-body { flex: 1; min-width: 0; }
.tracker-card .tr-title { font-size: 15px; font-weight: 600; }
.tracker-card .tr-sum { color: var(--muted); font-size: 12.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tracker-card .tr-amount { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.tracker-card .tr-amount input { width: 150px; }
.tracker-card .tr-undo { display: inline-block; margin-top: 6px; font-size: 12.5px; cursor: pointer; }
.tracker-card .tr-done { flex-shrink: 0; align-self: flex-start; }

/* Réordonnancement des habitudes par glisser-déposer (Réglages). */
.row[draggable="true"] { cursor: grab; }
.row.tr-dragging { opacity: .4; background: var(--surface-2); border-radius: var(--radius-sm); }
.drag-handle { color: var(--muted); font-size: 15px; line-height: 1; cursor: grab; user-select: none; letter-spacing: -2px; flex-shrink: 0; }
.drag-handle:active { cursor: grabbing; }

/* Palette de pictogrammes (modale suivi). */
.emoji-picks { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.emoji-pick {
  width: 40px; height: 40px; border-radius: var(--radius-sm); cursor: pointer; font-size: 20px;
  background: var(--surface-2); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center;
}
.emoji-pick:hover { border-color: var(--accent); }
.emoji-pick.on { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 1px var(--accent); }