:root {
  --ivory: #FAF7F2;
  --ink: #1F1B16;
  --muted: #5E5750;
  --line: #ECE4D8;
  --line2: #D9CFC1;
  --sand: #F1ECE3;
  --green: #2F5D50;
  --green-dark: #234A40;
  --green-soft: #E3EEE9;
  --clay: #A34A2F;
  --clay-dark: #7E3620;
  --clay-soft: #F6E5DC;
  --photo: #EFE7DC;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ivory); color: var(--ink); font-family: var(--sans); font-size: 18px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
a { color: var(--green); }
a:hover { color: var(--green-dark); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.screen { max-width: 520px; margin: 0 auto; padding: 20px 20px calc(32px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 18px; min-height: 100vh; }
.screen.center { justify-content: center; align-items: center; text-align: center; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 22px; font-weight: 600; text-decoration: none; color: var(--ink); }
.avatar { width: 48px; height: 48px; border-radius: 24px; border: 1px solid #E6DED2; background: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink); }
.back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 700; text-decoration: none; color: var(--ink); align-self: flex-start; }
h1, .h1 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 30px; line-height: 1.15; }
h2, .h2 { margin: 0; font-size: 19px; font-weight: 700; }
.sub { margin: 0; color: var(--muted); }
.small { font-size: 15px; }
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 60px; padding: 10px 18px; border-radius: 18px; border: none; background: var(--green); color: #fff; font-size: 20px; font-weight: 700; text-decoration: none; cursor: pointer; box-shadow: 0 6px 18px rgba(47, 93, 80, 0.22); text-align: center; }
.btn:hover { color: #fff; background: var(--green-dark); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn-outline { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 8px 16px; border-radius: 16px; border: 1.5px solid var(--green); background: #fff; color: var(--green); font-size: 17px; font-weight: 700; text-decoration: none; cursor: pointer; text-align: center; }
.btn-small { min-height: 44px; padding: 6px 12px; border-radius: 14px; font-size: 16px; }
.btn-text { background: none; border: none; color: var(--clay); font-weight: 700; font-size: 16px; min-height: 44px; padding: 0 6px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn-danger { color: var(--clay-dark); border-color: var(--clay); }
.btn-block { width: 100%; }

.card { display: flex; align-items: center; gap: 14px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 20px; text-decoration: none; color: var(--ink); }
a.card:hover { color: var(--ink); border-color: var(--line2); }
.card.col { flex-direction: column; align-items: stretch; }
.thumb { width: 64px; height: 64px; flex-shrink: 0; border-radius: 14px; background: var(--photo); object-fit: cover; display: flex; align-items: center; justify-content: center; color: #7A6F62; }
.thumb.icon-green { background: var(--green-soft); color: var(--green); }
.thumb.icon-clay { background: var(--clay-soft); color: var(--clay); }
.photo-lg { width: 100%; max-height: 260px; object-fit: cover; border-radius: 18px; background: var(--photo); }
.photo-ph { height: 140px; border-radius: 18px; background: var(--photo); border: 1px dashed #CFC3B2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 16px; }
.title { font-size: 19px; font-weight: 700; line-height: 1.25; }
.meta { font-size: 15px; color: var(--muted); }

.badge { display: inline-flex; align-self: flex-start; padding: 4px 10px; border-radius: 12px; font-size: 15px; font-weight: 700; }
.badge.ok { background: var(--green-soft); color: var(--green-dark); }
.badge.warm { background: var(--clay-soft); color: var(--clay-dark); }
.badge.neutral { background: var(--sand); color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1.5px solid var(--line2); background: #fff; font-size: 16px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.chip[aria-pressed="true"] { border: 2px solid var(--green); background: var(--green-soft); font-weight: 700; }

.tile { display: flex; align-items: center; gap: 16px; min-height: 104px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 22px; cursor: pointer; text-decoration: none; color: var(--ink); }
.tile:hover { border-color: var(--line2); color: var(--ink); }
.tile-icon { width: 58px; height: 58px; flex-shrink: 0; border-radius: 29px; display: flex; align-items: center; justify-content: center; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 17px; font-weight: 700; }
.input { min-height: 54px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--line2); background: #fff; font-size: 19px; width: 100%; }
.input:focus, .chip:focus-visible, .btn:focus-visible, .btn-outline:focus-visible, .tile:focus-within { outline: 3px solid rgba(47, 93, 80, 0.35); outline-offset: 2px; }
textarea.input { padding: 12px 16px; min-height: 90px; resize: vertical; }

.note { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; background: var(--sand); font-size: 16px; line-height: 1.35; }
.note.green { background: var(--green-soft); }
.note.warm { background: var(--clay-soft); }
.check-row { display: flex; align-items: center; gap: 12px; min-height: 50px; border-top: 1px solid var(--sand); font-size: 18px; }
.check-row:first-of-type { border-top: none; }
.check-row input { width: 24px; height: 24px; accent-color: var(--green); margin: 0; flex-shrink: 0; }
.group { padding: 6px 14px; background: #fff; border: 1px solid var(--line); border-radius: 18px; }
.group-head { display: flex; align-items: center; justify-content: space-between; min-height: 46px; }

.switch { width: 56px; height: 32px; flex-shrink: 0; padding: 3px; border-radius: 16px; border: none; background: #CFC3B2; display: inline-flex; align-items: center; cursor: pointer; }
.switch span { width: 26px; height: 26px; border-radius: 13px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
.switch[aria-pressed="true"] { background: var(--green); }
.switch[aria-pressed="true"] span { transform: translateX(24px); }

.empty { padding: 18px; border-radius: 18px; border: 1.5px dashed var(--line2); color: var(--muted); text-align: center; font-size: 16px; }
.spacer { flex: 1 1 auto; }
.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; font-size: 15px; }

#modal .backdrop { position: fixed; inset: 0; background: rgba(31, 27, 22, 0.45); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
#modal .sheet { width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--ivory); border-radius: 26px 26px 0 0; padding: 22px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 560px) { #modal .backdrop { align-items: center; } #modal .sheet { border-radius: 26px; } }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 14px 20px; border-radius: 16px; font-size: 17px; max-width: 90vw; z-index: 60; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
#toast.show { opacity: 1; }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--green); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.star { width: 48px; height: 48px; flex-shrink: 0; border: none; background: transparent; border-radius: 24px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.star:hover { background: var(--sand); }

/* v2.2 : bouton Accueil, aperçu des liens */
.navrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 22px;
  background: var(--green-soft); color: var(--green); font-weight: 700; text-decoration: none; }
.spin-sm { display: inline-block; vertical-align: -3px; width: 16px; height: 16px; margin-right: 6px; border-radius: 50%;
  border: 2px solid var(--line2); border-top-color: var(--green); animation: spin 0.8s linear infinite; }
#preview-status:empty { display: none; }

/* v2.4 : photos de listes et de cercles */
.thumb-photo { object-fit: cover; }
.thumb-photo.round { width: 52px; height: 52px; border-radius: 26px; }
.hero-photo { width: 84px; height: 84px; border-radius: 42px; object-fit: cover; flex-shrink: 0; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.hero-empty { display: flex; align-items: center; justify-content: center; background: var(--photo); color: #7A6F62; box-shadow: none; }
