/* Notre Tribu : grands boutons, texte lisible, contraste élevé. Une action principale par écran. */
:root {
  --bg: #f5f3ee; --card: #ffffff; --text: #14201b; --muted: #47524d; --line: #cdc7bb;
  --accent: #1f5c4b; --accent-strong: #174636; --on-accent: #ffffff; --accent-soft: #e1ede7;
  --danger: #a3311d; --danger-soft: #f8e4df; --gift: #8a2c5e; --gift-soft: #f6e4ee; --focus: #f0a500;
  --fs: 18px;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #121815; --card: #1c2420; --text: #f1f4f2; --muted: #b9c3be; --line: #3a4641;
  --accent: #7fd1b3; --accent-strong: #a5e3cc; --on-accent: #0c1a14; --accent-soft: #22362e;
  --danger: #ff9b85; --danger-soft: #3a211b; --gift: #f19ac7; --gift-soft: #3a2230; --focus: #ffc94d;
  color-scheme: dark; } }
:root.big { --fs: 22px; }
html { font-size: var(--fs); }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(5.4rem + env(safe-area-inset-bottom, 0px)); }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
main { max-width: 640px; margin: 0 auto; padding: .8rem max(16px, env(safe-area-inset-right, 0px)) 1rem max(16px, env(safe-area-inset-left, 0px)); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .3em 0 .5em; text-wrap: balance; }
h2 { font-size: 1.2rem; margin: 1.4em 0 .6em; }
p { margin: .5em 0; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.pre { white-space: pre-wrap; }
.center { text-align: center; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* En-tête */
.top { position: sticky; top: 0; z-index: 5; background: var(--accent); color: var(--on-accent); padding-top: env(safe-area-inset-top, 0px); }
.top-in { max-width: 640px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: .55rem max(16px, env(safe-area-inset-right, 0px)) .55rem max(16px, env(safe-area-inset-left, 0px)); }
.brand { white-space: nowrap; font-weight: 800; font-size: 1.1rem; color: inherit; text-decoration: none; padding: 6px 0; }
.aa { background: var(--on-accent); color: var(--accent); border: 0; border-radius: 10px; font-weight: 800; min-height: 44px; min-width: 52px; cursor: pointer; }

/* Boutons : toujours avec un mot */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; min-height: 52px; padding: .5em 1.1em;
  font-weight: 700; background: var(--accent); color: var(--on-accent); border: 0; border-radius: 14px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--accent-strong); }
.btn:disabled { opacity: .6; }
.btn.full { width: 100%; }
.btn.light { background: var(--accent-soft); color: var(--accent); }
.btn.outline { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.btn.danger { background: transparent; color: var(--danger); border: 2px solid var(--danger); }
.btn.gift { background: var(--gift); color: var(--on-accent); }
.btn.sm { min-height: 44px; padding: .3em .9em; font-size: .92rem; border-radius: 12px; }
.back { display: inline-flex; align-items: center; min-height: 48px; font-weight: 700; color: var(--accent); }
.alert { background: var(--danger-soft); color: var(--danger); padding: .8rem 1rem; border-radius: 14px; font-weight: 600; }

/* Accueil */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: .6rem 0 1rem; }
.tile { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: .3rem; min-height: 8.2rem; padding: 1rem;
  border-radius: 20px; text-decoration: none; color: var(--text); background: var(--card); box-shadow: inset 0 0 0 2px var(--line); }
.tile .ico { font-size: 2.3rem; line-height: 1; }
.tile strong { font-size: 1.15rem; }
.tile .sub { font-size: .85rem; color: var(--muted); }
.tile.main { grid-column: 1 / -1; min-height: 6rem; flex-direction: row; align-items: center; justify-content: flex-start; gap: 1rem;
  background: var(--accent); color: var(--on-accent); box-shadow: none; }
.tile.main .sub { color: var(--on-accent); opacity: .9; }

/* Blocs */
.card { background: var(--card); border-radius: 18px; padding: 1rem; margin: .8rem 0; box-shadow: inset 0 0 0 1.5px var(--line); }
.row { display: flex; gap: 12px; align-items: center; background: var(--card); border-radius: 16px; padding: .8rem 1rem; margin: .55rem 0;
  box-shadow: inset 0 0 0 1.5px var(--line); color: var(--text); text-decoration: none; }
.row .ico { font-size: 1.8rem; flex: none; }
.grow { flex: 1; min-width: 0; }
.chev { font-size: 1.6rem; color: var(--muted); flex: none; }
.who-sees { display: inline-block; font-size: .82rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.who-sees.me { background: var(--line); color: var(--text); }
.explain { padding: .8rem 1rem; border-radius: 14px; background: var(--gift-soft); }
.explain.green { background: var(--accent-soft); }

/* Formulaires */
.stack { display: flex; flex-direction: column; gap: .9rem; }
label.field { display: flex; flex-direction: column; gap: .3rem; font-weight: 700; }
.hint { font-weight: 400; font-size: .85rem; color: var(--muted); }
input, select, textarea { font: inherit; color: inherit; background: var(--bg); border: 2px solid var(--line); border-radius: 12px; padding: .65em .8em; width: 100%; min-height: 52px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
.choices { display: grid; gap: 8px; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choice { display: flex; align-items: center; gap: .6rem; min-height: 52px; padding: .5rem .8rem; border-radius: 12px; background: var(--bg);
  box-shadow: inset 0 0 0 2px var(--line); cursor: pointer; font-weight: 600; }
.choice input { width: 1.4rem; height: 1.4rem; min-height: 0; margin: 0; accent-color: var(--accent); flex: none; }
.choice:has(input:checked) { box-shadow: inset 0 0 0 3px var(--accent); background: var(--accent-soft); }
details.more > summary { cursor: pointer; color: var(--accent); font-weight: 700; min-height: 44px; display: flex; align-items: center; }
details.more[open] > summary { margin-bottom: .5rem; }
details.add > summary { list-style: none; }
details.add > summary::-webkit-details-marker { display: none; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }
.inline .btn { flex: none; }
.legend-q { font-weight: 700; margin: 0 0 .4rem; }

/* Éléments de liste */
.items { list-style: none; padding: 0; margin: .8rem 0; display: flex; flex-direction: column; gap: .55rem; }
.item { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border-radius: 16px; padding: .75rem .9rem; box-shadow: inset 0 0 0 1.5px var(--line); }
.item.done { opacity: .7; }
.item.done .txt { text-decoration: line-through; }
.item.reserved { box-shadow: inset 0 0 0 2.5px var(--gift); }
.item form { margin: 0; }
.box { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 10px; border: 2.5px solid var(--accent); background: var(--card); cursor: pointer;
  display: grid; place-items: center; font-size: 1.4rem; font-weight: 900; color: var(--on-accent); padding: 0; }
.box.on { background: var(--accent); }
.txt { font-weight: 700; font-size: 1.05rem; }
.price { display: inline-block; font-weight: 700; color: var(--accent); margin-left: .3em; }
.old-price { text-decoration: line-through; color: var(--muted); font-size: .85rem; margin-left: .3em; }
.item-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-top: .4rem; }
.thumb { flex: none; width: 4.2rem; height: 4.2rem; border-radius: 12px; overflow: hidden; box-shadow: inset 0 0 0 1.5px var(--line); display: block; }
.thumb img, .preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.taken { display: inline-block; font-weight: 700; color: var(--gift); }
.textlink { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; min-height: 44px; font-size: .92rem; display: inline-flex; align-items: center; }
.textlink.danger { color: var(--danger); }
.preview { position: relative; width: 7rem; height: 7rem; border-radius: 14px; overflow: hidden; box-shadow: inset 0 0 0 1.5px var(--line); }

/* Agenda */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border-radius: 14px; padding: 4px; box-shadow: inset 0 0 0 1.5px var(--line); margin-bottom: .8rem; }
.seg a { min-height: 46px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; color: var(--muted); text-decoration: none; }
.seg a.on { background: var(--accent); color: var(--on-accent); }
.when { font-weight: 700; color: var(--accent); }
.day-title { font-size: .95rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1.3em 0 .3em; }
.ev { border-left: 6px solid var(--ev, var(--line)); }
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: .4rem 0; }
.cal-nav strong { font-size: 1.15rem; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; background: var(--card); border-radius: 16px; padding: 6px; box-shadow: inset 0 0 0 1.5px var(--line); }
.cal-dow { text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-day { aspect-ratio: 1; min-height: 44px; border-radius: 12px; display: flex; flex-direction: column; color: var(--text); text-decoration: none;
  align-items: center; justify-content: center; gap: 3px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-day.out { opacity: .35; }
.cal-day.today { box-shadow: inset 0 0 0 2.5px var(--accent); color: var(--accent); font-weight: 900; }
.cal-day.sel { background: var(--accent); color: var(--on-accent); }
.dots { display: flex; gap: 3px; min-height: 8px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; display: block; }
.cal-day.sel .dots i { box-shadow: 0 0 0 1.5px var(--on-accent); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .85rem; color: var(--muted); margin-top: .5rem; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 5px; }

/* Assistant */
.chat { display: flex; flex-direction: column; gap: .6rem; }
.bubble { max-width: 90%; padding: .7rem .9rem; border-radius: 16px; }
.bubble.me { align-self: flex-end; background: var(--accent); color: var(--on-accent); }
.bubble.bot { align-self: flex-start; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); white-space: pre-wrap; }
.bubble.err { color: var(--danger); }
.bubble ul { margin: .4rem 0 0; padding-left: 1.2rem; white-space: normal; }
.mic-big { display: flex; flex-direction: column; align-items: center; gap: .5rem; margin: 1rem 0; }
.mic { width: 6.5rem; height: 6.5rem; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); font-size: 2.8rem; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.mic.on { background: var(--danger); }
@media (prefers-reduced-motion: no-preference) { .mic.on { animation: pulse 1.2s infinite; } @keyframes pulse { 50% { transform: scale(1.07); } } }
.mic:disabled { opacity: .45; cursor: not-allowed; }
.mic-label { font-weight: 700; text-align: center; }

/* Onglets du bas : icône + mot */
nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card);
  border-top: 2px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
nav.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .45rem 0 .5rem; min-height: 4.4rem; text-decoration: none; color: var(--muted); }
nav.tabs .i { font-size: 1.6rem; line-height: 1.2; }
nav.tabs .l { font-size: .8rem; font-weight: 700; }
nav.tabs a.active { color: var(--accent); background: var(--accent-soft); }

/* Message en bas, avec « Annuler » */
.toast { position: fixed; left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); bottom: calc(5.4rem + env(safe-area-inset-bottom, 0px));
  max-width: 560px; margin: 0 auto; z-index: 20; display: flex; align-items: center; gap: 12px; justify-content: space-between;
  background: var(--text); color: var(--bg); padding: .8rem 1rem; border-radius: 14px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast form { margin: 0; flex: none; }
.toast button { background: var(--bg); color: var(--text); border: 0; border-radius: 10px; min-height: 44px; padding: 0 .9rem; font-weight: 800; cursor: pointer; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: up .2s ease-out; } @keyframes up { from { transform: translateY(10px); opacity: 0; } } }
.confirm { background: var(--danger-soft); border-radius: 14px; padding: .8rem 1rem; }
.auth { max-width: 26rem; margin: 1.5rem auto; }
input.pin { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; }
