/* Mon Lutin Potager — interface V2. Accueil coloré, reste de l'appli sobre (blanc, actions vertes). */
:root {
  --ink: #102A1E; --muted: #4D5B52; --soft: #7A877E; --line: #EEF1EE; --border: #D6DED7;
  --green: #1E7B3E; --green-2: #2E9445; --green-dark: #14532D; --green-bg: #E3F2E5; --green-pale: #F4F9F3; --green-line: #DCEBDD;
  --gold: #7A4F00; --gold-bg: #FDF4DE; --gold-dot: #E8A317;
  --red: #B3261E; --red-bg: #FDE4E1; --blue: #2F7FD0; --blue-ink: #123E70; --blue-bg: #E3EEFB;
  --page: #FFFFFF; --field: #F7F9F7; --chip: #F0F3F0;
  --nav-h: 76px; --safe-b: env(safe-area-inset-bottom, 0px); --radius: 14px;
  --font: 'Nunito', 'Segoe UI', Roboto, system-ui, sans-serif; --hand: 'Caveat', 'Segoe Print', cursive;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); font-size: 16px; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
.ill { display: block; flex-shrink: 0; border-radius: 22%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid #7CC576; outline-offset: 2px; }

#v2 { max-width: 560px; margin: 0 auto; min-height: 100dvh; position: relative; background: var(--page); }
.screen { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px); display: flex; flex-direction: column; }
.screen.no-nav { padding-bottom: calc(var(--safe-b) + 12px); }
.screen.with-fab { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 84px); }

/* En-têtes */
.top { display: flex; align-items: center; gap: 10px; padding: 14px 16px 8px; position: sticky; top: 0; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); z-index: 5; }
.top h1 { margin: 0; flex: 1; font-size: 24px; font-weight: 900; letter-spacing: -.02em; line-height: 1.1; }
.top.center h1 { text-align: center; font-size: 19px; }
.top .count { font-size: 13px; font-weight: 800; color: var(--muted); }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: none; background: transparent; color: var(--green); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; text-decoration: none; }
.icon-btn:active { background: var(--green-bg); }
.top-icon { width: 34px; height: 34px; border-radius: 17px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-weight: 900; }
.pill-btn { min-height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 20px; border: 1px solid var(--border); background: #fff; font-size: 14px; font-weight: 800; text-decoration: none; color: var(--ink); white-space: nowrap; }
.pill-btn.gold { background: var(--gold-bg); color: var(--gold); border: none; font-weight: 900; padding-left: 6px; }
.pill-btn.gold .dot { width: 28px; height: 28px; border-radius: 14px; background: var(--gold-dot); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.pad { padding: 0 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; font-weight: 700; }
.tiny { font-size: 12px; font-weight: 700; color: var(--muted); }
.h2 { margin: 6px 0 2px; font-size: 18px; font-weight: 900; letter-spacing: -.01em; }
.section-title { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: none; margin: 8px 0 2px; }

/* Barre de navigation */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: #fff; border-top: 1px solid #E5EAE5; padding: 6px 6px calc(10px + var(--safe-b)); max-width: 560px; margin: 0 auto; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 700; }
.nav a span { display: flex; align-items: center; justify-content: center; width: 56px; height: 32px; border-radius: 16px; }
.nav a[aria-current="page"] { color: var(--green); font-weight: 900; }
.nav a[aria-current="page"] span { background: var(--green-bg); }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 18px; border-radius: var(--radius); border: none; background: var(--green); color: #fff; font-size: 16px; font-weight: 900; text-decoration: none; }
.btn:active { filter: brightness(.92); }
.btn.soft { background: #EEF6EC; color: var(--green); }
.btn.line { background: #fff; color: var(--green); border: 1px solid #C9DECB; }
.btn.danger { background: var(--red-bg); color: var(--red); }
.btn.small { min-height: 40px; font-size: 14px; padding: 0 14px; border-radius: 20px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; }
.fab { position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); max-width: 528px; margin: 0 auto; z-index: 15; box-shadow: 0 6px 14px rgba(30,123,62,.3); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 16px calc(16px + var(--safe-b)); border-top: 1px solid #E5EAE5; position: sticky; bottom: 0; background: #fff; margin-top: auto; z-index: 5; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; border: none; background: none; padding: 0; font-size: 14px; font-weight: 800; color: var(--green); text-decoration: none; }

/* Champs */
.search { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 8px 0 14px; border-radius: 28px; border: 1px solid var(--border); background: var(--field); }
.search.strong { border: 2px solid var(--green); background: #fff; box-shadow: 0 0 0 4px #D5EBD6; }
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 17px; font-weight: 800; }
.search input::placeholder { color: #8A968E; font-weight: 700; }
.search .clear { width: 40px; height: 40px; border-radius: 20px; border: none; background: var(--chip); color: var(--muted); display: flex; align-items: center; justify-content: center; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 800; color: var(--muted); }
.input, .field input, .field select, .field textarea { min-height: 48px; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 12px; background: #fff; font-size: 16px; font-weight: 800; color: var(--ink); width: 100%; }
.field textarea { padding: 10px 12px; min-height: 84px; resize: vertical; font-weight: 700; }
.input.big { min-height: 58px; border: 2px solid var(--green); font-size: 26px; font-weight: 900; }
.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; }
.seg { display: flex; background: var(--chip); border-radius: var(--radius); padding: 4px; gap: 4px; }
.seg button { flex: 1; min-height: 40px; min-width: 40px; border: none; border-radius: 10px; background: transparent; font-size: 14px; font-weight: 800; color: var(--muted); padding: 0 4px; white-space: nowrap; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--green); color: #fff; font-weight: 900; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--border); background: #fff; font-size: 13px; font-weight: 800; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); position: relative; }
.chip[aria-pressed="true"] { background: var(--green); color: #fff; border-color: var(--green); font-weight: 900; }
.chip.add { border: 2px dashed #8CC59A; background: #F4FAF4; color: var(--green); font-weight: 900; }
.chip.with-ill { padding-left: 4px; background: var(--green-pale); border-color: var(--green-line); }
.chip .x { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 12px; border: none; background: #F8D7D3; color: var(--red); font-size: 14px; font-weight: 900; line-height: 24px; padding: 0; }
.chip.editing { padding-right: 32px; }

/* Listes */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 6px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.item:active { background: #F7FAF7; }
.item .t { font-size: 16px; font-weight: 900; line-height: 1.2; }
.item .s { font-size: 12px; font-weight: 700; color: var(--muted); }
.item .v { font-size: 15px; font-weight: 900; color: var(--gold); white-space: nowrap; }
.item .chev { color: #7A877E; flex-shrink: 0; }
.tag { font-size: 12px; font-weight: 900; color: var(--gold); background: var(--gold-bg); border-radius: 10px; padding: 4px 8px; white-space: nowrap; }
.tag.green { color: #1E6B36; background: var(--green-bg); }
.tag.blue { color: var(--blue-ink); background: var(--blue-bg); }
.tag.red { color: var(--red); background: var(--red-bg); }
.hl { font-weight: 900; color: var(--green); }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* Cartes sobres */
.card { border: 1px solid #E5EAE5; border-radius: 18px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.card.pale { background: var(--green-pale); border-color: var(--green-line); }
.card.gold { background: var(--gold-bg); border: none; }
.card.blue { background: var(--blue-bg); border: none; }
.card h2 { margin: 0; font-size: 16px; font-weight: 900; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi { border-radius: 16px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; background: #EEF6EC; }
.kpi.gold { background: var(--gold-bg); }
.kpi .l { font-size: 12px; font-weight: 700; color: var(--muted); }
.kpi .n { font-size: 20px; font-weight: 900; white-space: nowrap; letter-spacing: -.01em; }

/* Feuille modale (bas d'écran) */
.sheet-back { position: fixed; inset: 0; background: rgba(16,42,30,.42); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; background: #fff; border-radius: 22px 22px 0 0; padding: 8px 16px calc(18px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; animation: up .2s ease; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: #D6DED7; align-self: center; margin: 2px 0 4px; }
.sheet h2 { margin: 0; font-size: 20px; font-weight: 900; }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 18px); z-index: 60; background: #14301F; color: #fff; padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 800; box-shadow: 0 8px 20px rgba(0,0,0,.2); max-width: calc(100% - 32px); display: flex; gap: 12px; align-items: center; animation: up .2s ease; }
.toast button { background: none; border: none; color: #9FE0A8; font-weight: 900; font-size: 14px; }
.toast.err { background: #7A1C16; }

/* Accueil coloré */
.home { background: #FFF4E2; }
.home main { display: flex; flex-direction: column; gap: 12px; padding: 0 14px 14px; margin-top: -14px; position: relative; }
.home .banner:has(.alert) + main { margin-top: 8px; }
.hcard { border: 2px solid #fff; border-radius: 20px; padding: 12px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); min-width: 0; }
.hcard h2 { margin: 0; flex: 1; font-size: 15px; font-weight: 900; }
.hcard .badge { width: 30px; height: 30px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hcard .count { font-size: 11px; font-weight: 900; color: #fff; border-radius: 10px; padding: 3px 8px; }
.stat { flex-direction: row; align-items: center; gap: 8px; padding: 10px; box-shadow: 0 4px 14px rgba(16,42,30,.08); }
.stat .l { font-size: 12px; font-weight: 800; }
.stat .n { font-size: 20px; font-weight: 900; letter-spacing: -.02em; line-height: 1.15; white-space: nowrap; }
.stat .d { font-size: 11px; font-weight: 900; }
.quick { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 60px; border-radius: 30px; background: #2E9445; color: #fff; font-size: 21px; font-weight: 900; text-decoration: none; box-shadow: 0 5px 0 #1C6630, 0 10px 18px rgba(30,123,62,.3); }
.quick:active { transform: translateY(3px); box-shadow: 0 2px 0 #1C6630, 0 6px 12px rgba(30,123,62,.3); }
.wdays { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.wday { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0; border-radius: 12px; background: #fff; color: #1F3A55; }
.wday b { font-size: 11px; font-weight: 900; }
.wday span { font-size: 12px; font-weight: 900; white-space: nowrap; }
.wday.alert { background: #FDE4E1; color: var(--red); }
.task { display: flex; align-items: flex-start; gap: 8px; min-height: 40px; padding-top: 6px; font-size: 13px; font-weight: 700; line-height: 1.25; }
.task input { width: 20px; height: 20px; margin: 0; accent-color: #3B7DDD; flex-shrink: 0; }
.task.done { color: #6A7C96; text-decoration: line-through; }
.soon { display: flex; align-items: center; gap: 6px; min-height: 40px; border-top: 1px solid #FFCDB2; }
.soon .n { flex: 1; font-size: 12px; font-weight: 800; min-width: 0; line-height: 1.15; overflow-wrap: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.soon .tg { flex-shrink: 0; }
.soon .tg { font-size: 10px; font-weight: 900; border-radius: 10px; padding: 3px 6px; white-space: nowrap; }
.bar { height: 12px; border-radius: 6px; background: #fff; overflow: hidden; }
.bar > div { height: 100%; border-radius: 6px; background: #2E9445; }

/* Bannière */
.banner { position: relative; overflow: hidden; }
.banner .scene { position: relative; width: 100%; overflow: hidden; }
.banner svg.bg, .banner svg.fx { position: absolute; left: 0; width: 100%; display: block; pointer-events: none; }
.banner .lutin { position: absolute; left: 0; object-fit: contain; }
.banner .title { position: absolute; right: 50px; top: 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.banner .title strong { font-weight: 900; letter-spacing: -.02em; line-height: 1.05; white-space: nowrap; }
.banner .chiprow { display: flex; align-items: center; gap: 5px; flex-wrap: nowrap; }
.banner .season { font-size: 11.5px; font-weight: 900; color: #fff; background: #1E7B3E; border-radius: 12px; padding: 3px 9px; white-space: nowrap; }
.banner .plan { display: flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 900; color: #7A4F00; background: rgba(255,244,214,.95); border: 1px solid #F2C14E; border-radius: 12px; padding: 2px 9px; white-space: nowrap; text-decoration: none; }
.banner .greet { font-family: var(--hand); font-size: 20px; font-weight: 700; line-height: 1; white-space: nowrap; }
.banner .edit { position: absolute; right: 10px; top: 12px; width: 40px; height: 40px; border-radius: 20px; border: none; background: rgba(255,255,255,.88); color: #3C4A40; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(16,42,30,.15); }
.banner .alert { margin-top: -18px; position: relative; background: #FFF4E2; border-radius: 20px 20px 0 0; padding: 10px 12px 2px; }
.banner .alert a .grow span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner .alert a { display: flex; align-items: center; gap: 10px; border-radius: 14px; padding: 9px 12px; text-decoration: none; }
.banner .alert .dot { width: 34px; height: 34px; border-radius: 17px; color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.banner .offline { position: absolute; right: 56px; top: 18px; font-size: 11px; font-weight: 900; background: rgba(255,255,255,.9); color: var(--muted); border-radius: 10px; padding: 2px 8px; }

/* Calendrier */
.months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2px; }
.months i { height: 10px; border-radius: 3px; background: #EEF1EE; font-style: normal; }
.months i.s { background: #9FD3A8; } .months i.p { background: #2E9445; } .months i.h { background: #F2B33D; } .months i.b { outline: 2px solid #1E7B3E; outline-offset: -2px; }
.month-labels { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2px; font-size: 10px; font-weight: 800; color: var(--soft); text-align: center; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; font-weight: 700; color: var(--muted); }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--c); }
.season-band { display: flex; border-radius: 10px; overflow: hidden; font-size: 11px; font-weight: 900; }
.season-band div { padding: 6px 4px; text-align: center; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Plan du potager */
.plots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.plot { border-radius: 16px; border: 1px solid #E5EAE5; padding: 10px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); background: #fff; min-height: 104px; }
.plot.free { border: 2px dashed #C9DECB; background: #FAFCFA; }
.plot .pn { font-size: 15px; font-weight: 900; }
.plot .ills { display: flex; gap: 4px; flex-wrap: wrap; }

.photo-thumb { width: 54px; height: 54px; border-radius: 14px; object-fit: cover; flex-shrink: 0; }
.hero-photo { width: 100%; max-height: 240px; object-fit: cover; border-radius: 18px; }
.banner-note { font-size: 11px; color: var(--soft); font-weight: 700; }
.spinner { width: 22px; height: 22px; border: 3px solid #D5EBD6; border-top-color: var(--green); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.switch { position: relative; width: 52px; height: 32px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: #C9D3CB; transition: .15s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .15s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { left: 23px; }
.setting { display: flex; align-items: center; gap: 12px; min-height: 60px; border-bottom: 1px solid var(--line); }
.setting .t { font-size: 15px; font-weight: 900; }
.setting .s { font-size: 12px; font-weight: 700; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (min-width: 600px) { body { background: #EEF2EE; } #v2 { box-shadow: 0 0 40px rgba(0,0,0,.08); } }

.search .clear[hidden] { display: none; }

/* Accueil : chaque carte prend la hauteur de son contenu (maximum fixé) */
.home .grid2.fit { align-items: start; }
.home .grid2.fit > .hcard { max-height: 250px; overflow-y: auto; overscroll-behavior: contain; }
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
