/* ═══════════════════════════════════════════════
   TOKENS
═══════════════════════════════════════════════ */
:root {
  --gd:    #2C5F2D;
  --gm:    #4A7C59;
  --gl:    #97BC62;
  --cream: #F5F1E8;
  --cream2:#EDE8DB;
  --br:    #8B5E3C;
  --or:    #E07B39;
  --lav:   #7B6FA0;
  --yw:    #F5C842;
  --dark:  #2B2B2B;
  --sh:    0 2px 10px rgba(0,0,0,.13);
  --rad:   10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--cream); color: var(--dark); min-height: 100vh; }

/* ═══════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════ */
header {
  position: sticky; top: 0; z-index: 200;
  box-shadow: 0 2px 14px rgba(0,0,0,.35);
  overflow: hidden; line-height: 0;
}
header svg { display: block; width: 100%; height: auto; }
.hl { font-size: 1.8rem; flex-shrink: 0; }
.ht h1 { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.ht span { color: var(--yw); font-size: .82rem; font-style: italic; font-weight: 400; }

/* ═══════════════════════════════════════════════
   NAV
═══════════════════════════════════════════════ */
nav.tnav { background: var(--gm); display: flex; overflow-x: auto; scrollbar-width: none; }
nav.tnav::-webkit-scrollbar { display: none; }
nav.tnav button {
  flex-shrink: 0; background: none; border: none; color: rgba(255,255,255,.75);
  padding: .6rem 1.3rem; cursor: pointer; font-size: .9rem; font-weight: 600;
  white-space: nowrap; border-bottom: 3px solid transparent; transition: background .2s, color .2s;
}
nav.tnav button:hover { background: rgba(255,255,255,.1); color: #fff; }
nav.tnav button.act   { color: #fff; border-bottom-color: var(--yw); background: rgba(255,255,255,.12); }

/* ═══════════════════════════════════════════════
   PAGES
═══════════════════════════════════════════════ */
.pg     { display: none; }
.pg.act { display: block; }
main { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

/* ═══════════════════════════════════════════════
   LOADING
═══════════════════════════════════════════════ */
.ld { text-align: center; padding: 3rem; color: var(--gm); }
.sp { display: inline-block; width: 22px; height: 22px; border: 3px solid var(--gl); border-top-color: var(--gd); border-radius: 50%; animation: sp .8s linear infinite; vertical-align: middle; margin-right: .4rem; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════
   ACCUEIL — HERO
═══════════════════════════════════════════════ */
.hero {
  border-radius: var(--rad); overflow: hidden; box-shadow: var(--sh);
  margin-bottom: 2rem; position: relative; background: var(--gd);
  min-height: 300px; display: flex; align-items: flex-end;
}
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .78; }
.hero-ov {
  position: relative; z-index: 1; width: 100%; padding: 2rem 2.5rem;
  background: linear-gradient(to top, rgba(10,40,10,.85) 0%, transparent 100%);
}
.hero-ov h2 { font-family: Georgia,serif; font-size: 2rem; color: #fff; line-height: 1.2; }
.hero-ov p  { color: rgba(255,255,255,.8); margin-top: .4rem; }
.hero-fallback {
  min-height: 300px; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 1rem; color: #fff; text-align: center; padding: 2rem;
  background: linear-gradient(135deg, var(--gd) 0%, var(--gm) 100%);
  border-radius: var(--rad); box-shadow: var(--sh); margin-bottom: 2rem;
}
.hero-fallback .emoji { font-size: 4.5rem; }
.hero-fallback h2 { font-family: Georgia,serif; font-size: 1.8rem; }
.hero-fallback p  { color: rgba(255,255,255,.75); font-size: .9rem; }

/* ═══════════════════════════════════════════════
   ACCUEIL — CARDS MOIS
═══════════════════════════════════════════════ */
.sec-title { font-family: Georgia,serif; font-size: 1.35rem; color: var(--gd); margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; }
.mcard-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: .75rem; margin-bottom: 2rem; }
.mcard { border-radius: 8px; padding: 1rem; color: #fff; cursor: pointer; box-shadow: var(--sh); transition: transform .18s, box-shadow .18s; }
.mcard:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.mcard h3 { font-size: 1rem; font-weight: 700; }
.mcard p  { font-size: .77rem; opacity: .85; margin-top: .25rem; }
.mcard .cnt { margin-top: .6rem; font-size: .72rem; background: rgba(255,255,255,.2); border-radius: 999px; display: inline-block; padding: .15rem .6rem; }

/* ═══════════════════════════════════════════════
   AGENDA — ONGLETS
═══════════════════════════════════════════════ */
.mtabs { display: flex; overflow-x: auto; gap: 4px; margin-bottom: 1.2rem; scrollbar-width: none; padding-bottom: 2px; }
.mtabs::-webkit-scrollbar { display: none; }
.mtab { flex-shrink: 0; border: none; border-radius: 6px; padding: .35rem .85rem; cursor: pointer; font-size: .8rem; font-weight: 600; background: #ddd; color: #555; transition: background .2s, color .2s; }
.mtab.act { color: #fff; }
.mnav { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.mnav h2  { font-family: Georgia,serif; font-size: 1.7rem; color: var(--gd); flex: 1; }
.mnav .sub { color: var(--gm); font-style: italic; font-size: .88rem; width: 100%; order: 3; }

/* ═══════════════════════════════════════════════
   CALENDRIER
═══════════════════════════════════════════════ */
.cal { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; border-radius: var(--rad); overflow: hidden; background: #bbb; box-shadow: var(--sh); }
.dh { background: var(--gd); color: #fff; text-align: center; padding: .45rem .2rem; font-size: .75rem; font-weight: 700; letter-spacing: .03em; }
.dh.we { background: #3d7a3e; }
.dc { background: #fff; min-height: 108px; padding: .32rem; display: flex; flex-direction: column; gap: .18rem; }
.dc.emp { background: #eae6e0; }
.dc.we  { background: #f0f4ef; }
.dn { font-size: .7rem; font-weight: 700; color: #bbb; }
.dc.ev .dn { color: rgba(255,255,255,.8); }
.evc { flex: 1; border-radius: 6px; padding: .28rem .38rem; display: flex; flex-direction: column; gap: .22rem; }
.ei  { font-size: .9rem; }
.el  { font-size: .72rem; font-weight: 600; color: #fff; line-height: 1.25; }
.vcs { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.vc  { background: rgba(255,255,255,.22); color: #fff; border-radius: 999px; font-size: .58rem; padding: 1px 5px; font-weight: 600; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; transition: background .15s; }
.vc:hover { background: rgba(255,255,255,.42); }
.bsign { margin-top: auto; background: rgba(255,255,255,.17); border: 1.5px dashed rgba(255,255,255,.5); color: #fff; border-radius: 5px; padding: .17rem .32rem; font-size: .64rem; cursor: pointer; text-align: center; transition: background .2s; }
.bsign:hover { background: rgba(255,255,255,.3); }
.legend { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; padding: .9rem 1rem; background: #fff; border-radius: var(--rad); box-shadow: var(--sh); }
.legend strong { font-size: .77rem; color: #666; margin-right: .3rem; }
.li  { display: flex; align-items: center; gap: .32rem; font-size: .77rem; }
.ld2 { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

/* ═══════════════════════════════════════════════
   CALENDRIER — améliorations interactions
═══════════════════════════════════════════════ */
.dc-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .15rem;
}
.add-ev-btn {
  background: rgba(0,0,0,.08); border: none; border-radius: 4px;
  color: #888; font-size: .75rem; cursor: pointer; padding: .05rem .3rem;
  line-height: 1.4; transition: background .15s, color .15s;
  flex-shrink: 0;
}
.add-ev-btn:hover { background: var(--gd); color: #fff; }

.dc-empty-click { cursor: pointer; transition: background .15s; }
.dc-empty-click:hover { background: #f0f7ee !important; }
.dc-empty-click:hover .add-hint { opacity: 1; }

.add-hint {
  font-size: .75rem; color: #ccc; opacity: 0;
  transition: opacity .15s; user-select: none;
}

/* Bouton modifier dans l'event card */
.ev-top-row {
  display: flex; align-items: flex-start; gap: .25rem;
}
.ev-top-row .ei  { flex-shrink: 0; }
.ev-top-row .el  { flex: 1; }
.ev-edit-btn {
  background: rgba(255,255,255,.18); border: none; border-radius: 4px;
  color: #fff; font-size: .65rem; cursor: pointer; padding: .1rem .25rem;
  flex-shrink: 0; opacity: .7; transition: opacity .15s, background .15s;
}
.ev-edit-btn:hover { opacity: 1; background: rgba(255,255,255,.35); }

/* ═══════════════════════════════════════════════
   MODALE ÉVÉNEMENT — aperçu + grille de types
═══════════════════════════════════════════════ */
.modal-ev-preview {
  border-radius: 8px; padding: .55rem .9rem; margin-bottom: 1.1rem;
  font-size: .9rem; font-weight: 700; color: #fff;
  min-height: 2.4rem; transition: background .2s;
}

.ev-type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .4rem;
  margin-top: .2rem;
}

.type-btn {
  display: flex; flex-direction: column; align-items: center; gap: .18rem;
  border: 2px solid #e0e0e0; border-radius: 8px; background: #fff;
  padding: .45rem .25rem; cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.type-btn:hover { border-color: var(--tc, #aaa); background: #f8f8f8; transform: translateY(-1px); }
.type-btn.act   { border-color: var(--tc, #aaa); background: var(--tc, #aaa); }
.type-btn.act .type-label { color: #fff; }

.type-icon  { font-size: 1.25rem; line-height: 1; }
.type-label { font-size: .65rem; font-weight: 600; color: #555; text-align: center; line-height: 1.2; }

@media(max-width:420px) {
  .ev-type-grid { grid-template-columns: repeat(3,1fr); }
}
.garden-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .6rem; margin-bottom: 1.3rem;
}
.garden-title { font-family: Georgia,serif; font-size: 1.55rem; color: var(--gd); }
.garden-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════
   POTAGER — GRILLE DE PLANCHES
═══════════════════════════════════════════════ */
.ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 1.2rem; }

/* Carte planche */
.zcard {
  background: #fff; border-radius: var(--rad); box-shadow: var(--sh);
  overflow: hidden; transition: box-shadow .2s;
  border: 2px solid transparent;
}
.zcard.drop-target {
  border-color: var(--gl);
  box-shadow: 0 0 0 3px rgba(151,188,98,.35);
}

/* En-tête planche */
.zh { padding: .75rem 1rem; display: flex; align-items: center; gap: .5rem; color: #fff; }
.bed-name-row { display: flex; align-items: center; gap: .4rem; flex-wrap: nowrap; }
.bed-icon { font-size: 1.1rem; flex-shrink: 0; }
.bed-name { font-size: .98rem; font-weight: 700; }
.bed-sub  { font-size: .76rem; opacity: .82; margin-top: .15rem; }

.bed-rename-btn, .bed-edit-btn {
  background: rgba(255,255,255,.18); border: none; border-radius: 5px;
  color: #fff; cursor: pointer; font-size: .8rem; padding: .18rem .4rem;
  transition: background .15s; flex-shrink: 0;
}
.bed-rename-btn:hover, .bed-edit-btn:hover { background: rgba(255,255,255,.35); }

/* Input renommage inline */
.bed-inline-input {
  background: rgba(255,255,255,.9); border: none; border-radius: 5px;
  color: var(--dark); font-size: .95rem; font-weight: 700;
  padding: .12rem .45rem; outline: 2px solid white;
  min-width: 0; width: 150px;
}

/* ═══════════════════════════════════════════════
   POTAGER — LISTE DE LÉGUMES
═══════════════════════════════════════════════ */
.vlist { padding: .6rem .85rem; display: flex; flex-direction: column; gap: .38rem; min-height: 48px; }

.vi {
  display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem;
  background: var(--cream); border-radius: 7px;
  transition: background .15s, box-shadow .15s, opacity .15s;
  cursor: default;
}
.vi:hover { background: var(--cream2); }

/* En cours de drag */
.vi[draggable="true"] { cursor: grab; }
.vi[draggable="true"]:active { cursor: grabbing; }
.vi.dragging { opacity: .45; box-shadow: 0 4px 14px rgba(0,0,0,.18); }

.drag-handle {
  color: #ccc; font-size: 1rem; cursor: grab; flex-shrink: 0;
  line-height: 1; user-select: none;
}
.drag-handle:active { cursor: grabbing; }

.vem { font-size: 1.25rem; flex-shrink: 0; }
.vnm { font-weight: 700; font-size: .85rem; }
.vdt { font-size: .72rem; color: #777; margin-top: .06rem; line-height: 1.3; }

.vebtn {
  background: none; border: 1px solid #ccc; border-radius: 5px;
  padding: .2rem .42rem; font-size: .7rem; cursor: pointer; color: #777;
  transition: border-color .15s, color .15s; flex-shrink: 0;
}
.vebtn:hover { border-color: var(--gm); color: var(--gm); }

.avbtn {
  margin: 0 .85rem .85rem; width: calc(100% - 1.7rem);
  background: none; border: 2px dashed var(--gl); color: var(--gm);
  border-radius: 7px; padding: .45rem; font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: background .2s;
}
.avbtn:hover { background: rgba(151,188,98,.1); }

.empty-bed { font-size: .8rem; color: #bbb; font-style: italic; text-align: center; padding: .5rem 0; }

/* ═══════════════════════════════════════════════
   BOUTONS GLOBAUX
═══════════════════════════════════════════════ */
.bprm {
  border: none; border-radius: 8px; padding: .55rem 1rem;
  font-size: .88rem; cursor: pointer; font-weight: 700;
  color: #fff; background: var(--gd); transition: background .2s;
}
.bprm:hover    { background: var(--gm); }
.bprm:disabled { background: #aaa; cursor: not-allowed; }

.bsec {
  border: 2px solid var(--gd); border-radius: 8px; padding: .52rem 1rem;
  font-size: .88rem; cursor: pointer; font-weight: 700;
  color: var(--gd); background: #fff; transition: background .2s, color .2s;
}
.bsec:hover { background: var(--gd); color: #fff; }

/* ═══════════════════════════════════════════════
   MODALES
═══════════════════════════════════════════════ */
.bd { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.52); z-index: 500; align-items: center; justify-content: center; padding: 1rem; }
.bd.open { display: flex; }
.modal { background: #fff; border-radius: 16px; padding: 1.7rem; width: 100%; max-width: 460px; box-shadow: 0 8px 32px rgba(0,0,0,.28); animation: pi .2s ease; }
@keyframes pi { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h3 { font-size: 1.1rem; color: var(--gd); margin-bottom: .22rem; }
.msub     { font-size: .82rem; color: #999; margin-bottom: 1rem; }
.evbadge  { border-radius: 8px; padding: .55rem .9rem; margin-bottom: 1.1rem; font-size: .9rem; font-weight: 700; color: #fff; }

.field { margin-bottom: .9rem; }
.field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .32rem; }
.field input,
.field textarea,
.field select {
  width: 100%; border: 2px solid #ddd; border-radius: 8px;
  padding: .58rem .78rem; font-size: .9rem; font-family: inherit;
  outline: none; transition: border-color .2s; resize: vertical;
}
.field input:focus,
.field textarea:focus,
.field select:focus { border-color: var(--gm); }

/* Inscrits */
.vmt    { font-size: .82rem; font-weight: 600; margin-bottom: .45rem; }
.vmlist { display: flex; flex-wrap: wrap; gap: .38rem; min-height: 30px; }
.vpill  { display: flex; align-items: center; gap: .38rem; background: var(--cream); border: 1px solid #ddd; border-radius: 999px; padding: .22rem .68rem; font-size: .8rem; }
.vpill .dv, .vpill .ev2 { background: none; border: none; cursor: pointer; color: #bbb; font-size: .88rem; padding: 0; line-height: 1; transition: color .15s; }
.vpill .dv:hover  { color: #e00; }
.vpill .ev2:hover { color: var(--gm); }
.nov { font-size: .8rem; color: #bbb; font-style: italic; }

/* Actions modale */
.mact { display: flex; gap: .7rem; margin-top: 1.1rem; }
.bcnl { flex: 1; background: #eee; border: none; border-radius: 8px; padding: .62rem; font-size: .88rem; cursor: pointer; font-weight: 600; color: #555; }
.bcnl:hover { background: #e0e0e0; }
.bdng { background: #c0392b; color: #fff; border: none; border-radius: 8px; padding: .62rem 1rem; font-size: .84rem; cursor: pointer; font-weight: 600; }
.bdng:hover { background: #a93226; }

/* ═══════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════ */
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--gd); color: #fff; padding: .62rem 1.4rem; border-radius: 999px; font-size: .87rem; font-weight: 600; transition: transform .3s ease; z-index: 1000; box-shadow: 0 4px 16px rgba(0,0,0,.28); pointer-events: none; }
.toast.show { transform: translateX(-50%) translateY(0); }

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */
@media(max-width:600px) {
  .dc    { min-height: 72px; padding: .2rem; }
  .el    { font-size: .6rem; }
  .dh    { font-size: .6rem; }
  .bsign { font-size: .56rem; }
  .ht h1 { font-size: .95rem; }
  .ggrid { grid-template-columns: 1fr; }
}
