:root {
  --app-cream: #F4F1EA;
  --app-sage: #A8C3A0;
  --app-sage-dark: #6F8F68;
  /* Sauge des actions et du texte : la sauge profonde n'atteint pas 4,5:1 sous du texte blanc ni sur le crème. */
  --app-sage-ink: #4F6A4A;
  /* Rouge d'erreur de DESIGN.md : 4,6:1 sur le papier des cartes. */
  --app-error: #E50000;
  --app-grey: #B8BDB5;
  --app-grey-dark: #7E847B;
  --app-brown: #B89B7A;
  --app-brown-dark: #7D6247;
  --app-text: #3E3A33;
  --bs-body-bg: var(--app-cream);
  --bs-body-color: var(--app-text);
  /* Les variantes sans -rgb pilotent les onglets (--bs-nav-link-color) : sans elles, ils restent bleus. */
  --bs-link-color: #4F6A4A;
  --bs-link-color-rgb: 79, 106, 74;
  --bs-link-hover-color: #435A3F;
  --bs-link-hover-color-rgb: 67, 90, 63;
  --bs-focus-ring-color: rgba(111, 143, 104, 0.35);
  accent-color: var(--app-sage-dark);
}

/* Exemple dans un champ : italique et plus clair qu'une vraie valeur (10:1), mais encore lisible (4,5:1). */
.form-control::placeholder {
  color: #6B6F68;
  font-style: italic;
  opacity: 1;
}

::selection {
  background: #DCE7D8;
  color: var(--app-text);
}

html, body {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--app-cream);
  color: var(--app-text);
}

h1, h2, h3 {
  color: var(--app-brown-dark);
}

h1:focus {
  outline: none;
}

/* Mêmes teintes en mode nuit : le texte blanc garde au moins 6:1. */
.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: #4F6A4A;
  --bs-btn-border-color: #4F6A4A;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #435A3F;
  --bs-btn-hover-border-color: #435A3F;
  --bs-btn-active-bg: #384B35;
  --bs-btn-active-border-color: #384B35;
  --bs-btn-disabled-bg: var(--app-sage);
  --bs-btn-disabled-border-color: var(--app-sage);
}

/* Bootstrap garde son bleu partout ailleurs : contours, cases cochées, curseurs et alertes d'information passent à la sauge. */
.btn-outline-primary {
  --bs-btn-color: var(--app-sage-ink);
  --bs-btn-border-color: var(--app-sage-ink);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #4F6A4A;
  --bs-btn-hover-border-color: #4F6A4A;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #384B35;
  --bs-btn-active-border-color: #384B35;
  --bs-btn-disabled-color: var(--app-sage-ink);
  --bs-btn-disabled-border-color: var(--app-sage-ink);
}

/* Le gris de Bootstrap (#6C757D) reste sous 4,5:1 sur le crème comme sur le fond de nuit. */
.btn-outline-secondary {
  --bs-btn-color: #575E55;
  --bs-btn-border-color: var(--app-grey-dark);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #575E55;
  --bs-btn-hover-border-color: #575E55;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #4A5048;
  --bs-btn-active-border-color: #4A5048;
  --bs-btn-disabled-color: #575E55;
  --bs-btn-disabled-border-color: var(--app-grey-dark);
}

.form-check-input:checked {
  background-color: var(--app-sage-dark);
  border-color: var(--app-sage-dark);
}

.form-range::-webkit-slider-thumb,
.form-range:active::-webkit-slider-thumb {
  background-color: var(--app-sage-dark);
}

.form-range::-moz-range-thumb,
.form-range:active::-moz-range-thumb {
  background-color: var(--app-sage-dark);
}

.alert-info {
  --bs-alert-color: var(--app-text);
  --bs-alert-bg: #DCE7D8;
  --bs-alert-border-color: var(--app-sage);
  --bs-alert-link-color: var(--app-text);
}

.btn:focus, .btn:active:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(111, 143, 104, 0.35);
  border-color: var(--app-sage-dark);
}

.app-navbar {
  background: var(--app-sage);
  border-bottom: 3px solid var(--app-brown);
}

/* Sur la sauge feuille, le brun écorce n'atteint que 3:1 : la marque et les boutons de la barre prennent un ton plus sombre. */
.app-navbar .navbar-brand {
  font-weight: 600;
  color: #5A4532;
}

.app-navbar .btn-outline-secondary {
  --bs-btn-color: var(--app-text);
  --bs-btn-disabled-color: var(--app-text);
}

.app-navbar .nav-link {
  color: var(--app-text);
}

.app-navbar .nav-link.active {
  font-weight: 600;
  text-decoration: underline;
}

.app-nav-account {
  display: flex;
  align-items: center;
}

@media (max-width: 767.98px) {
  .app-nav-collapse {
    display: none;
  }

  #nav-toggle:checked ~ .app-nav-collapse {
    display: block;
  }

  /* Menu replié : mode nuit, langues et cloche sur une ligne ; le compte sur la suivante, aux deux bords.
     Entre les groupes (mode nuit, langues, cloche), 1,5rem. */
  .app-nav-tools {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 1.5rem;
  }

  .app-nav-tools .theme-toggle {
    margin-right: 0 !important;
  }

  .app-nav-account {
    flex-basis: 100%;
    justify-content: space-between;
  }
}

.app-card {
  background: #FBFAF6;
  border: 1px solid var(--app-grey);
  border-radius: 0.75rem;
}

.app-card .card-header {
  background: #EDE7DA;
  color: var(--app-brown-dark);
  font-weight: 600;
}

/* Accueil : le texte et un aperçu du plan côte à côte, l'un sous l'autre sur téléphone. */
.home-intro {
  display: grid;
  grid-template-columns: minmax(0, 32rem) minmax(0, 24rem);
  gap: 2rem;
  align-items: center;
  max-width: 62rem;
  margin: 0 auto;
}

@media (max-width: 767.98px) {
  .home-intro {
    grid-template-columns: minmax(0, 1fr);
  }
}

.home-promise {
  font-weight: 600;
  color: var(--app-sage-ink);
}

.home-plan {
  width: 100%;
  height: auto;
}

.home-benefits li + li {
  margin-top: 0.35rem;
}

/* Seconde section de l'accueil : un exemple de liste « à faire » et deux promesses. */
.home-more {
  display: grid;
  grid-template-columns: minmax(0, 24rem) minmax(0, 32rem);
  gap: 2rem;
  align-items: center;
  max-width: 62rem;
  margin: 0 auto 2rem;
}

@media (max-width: 767.98px) {
  .home-more {
    grid-template-columns: minmax(0, 1fr);
  }
}

.home-todo li + li {
  margin-top: 0.5rem;
}

.home-plan-compass {
  fill: var(--plan-vertex);
  stroke: var(--app-grey);
}

/* Carte de jardin : le nom est un lien étiré sur toute la carte ; les actions passent au-dessus de ce lien. */
.garden-card:hover,
.garden-card:focus-within {
  border-color: var(--app-sage-dark);
}

/* Vignette du plan en tête de carte, sur le fond du plan. */
.garden-thumb {
  height: 8rem;
  padding: 0.5rem;
  background: #EFEBE1;
  border-bottom: 1px solid var(--app-grey);
  border-radius: 0.75rem 0.75rem 0 0;
}

.garden-thumb.placeholder {
  display: block;
  width: 100%;
}

.plan-thumb {
  display: block;
  width: 100%;
  height: 100%;
}

.garden-todo {
  color: var(--app-sage-ink);
  font-weight: 600;
}

/* Carte « + Nouveau jardin » : en pointillés, elle se lit comme une place libre dans la grille. */
.garden-card-new {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 12rem;
  color: var(--app-sage-ink);
  font-weight: 600;
  background: transparent;
  border: 2px dashed var(--app-grey);
  border-radius: 0.75rem;
}

.garden-card-new:hover,
.garden-card-new:focus-visible {
  border-color: var(--app-sage-dark);
  background: #FBFAF6;
}

.garden-card-new:focus-visible {
  outline: 3px solid var(--app-sage-dark);
  outline-offset: 2px;
}

.garden-card-new-plus {
  font-size: 2rem;
  line-height: 1;
}

.garden-card .card-title a {
  color: inherit;
  text-decoration: none;
}

.garden-card .card-title a:hover {
  text-decoration: underline;
}

.garden-card .card-footer {
  background: transparent;
  border-top-color: var(--app-grey);
}

.garden-card-actions {
  position: relative;
  z-index: 2;
}

.text-app-error {
  color: var(--app-error) !important;
}

/* Import : un lien discret ; le champ fichier, masqué mais focalisable, donne son contour au libellé. */
.import-link {
  color: var(--app-sage-ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.import-link:focus-within {
  outline: 3px solid var(--app-sage-dark);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

.import-link.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Barre du plan (quinzaine, strates, zoom, enregistrement, Annuler) : elle reste visible pendant le défilement. Pas sur téléphone. */
@media (min-width: 768px) {
  .plan-toolbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: var(--app-cream);
    padding-block: 0.5rem;
  }

  /* La fiche amenée dans la vue ne doit pas finir sous la barre collante. */
  .editor-panel .card {
    scroll-margin-top: 4rem;
  }
}

/* Sous 768 px, le panneau est sous le plan. Une barre collante ne colle que dans son parent :
   la colonne du plan s'efface (display: contents) pour que la barre reste visible au-dessus du panneau. */
@media (max-width: 767.98px) {
  .editor-plan-col {
    display: contents;
  }

  .editor-plan-col > * {
    flex: 0 0 auto;
    width: calc(100% - var(--bs-gutter-x));
    margin-inline: calc(var(--bs-gutter-x) * 0.5);
  }

  /* La gouttière haute que la colonne recevait de .row. */
  .editor-plan-col > :first-child {
    margin-top: var(--bs-gutter-y);
  }
}

/* Téléphone : le curseur de quinzaine prend toute une ligne, sous son libellé et ses flèches. */
@media (max-width: 575.98px) {
  .period-row {
    flex-wrap: wrap;
  }

  .period-row .period-slider {
    order: 3;
    flex-basis: 100%;
  }
}

/* « Strates affichées » sur la même ligne que les libellés des cases, même quand elles grandissent au doigt. */
.layers-row {
  align-items: center;
}

/* Téléphone en portrait : les trois strates l'une sous l'autre, sous leur libellé. */
@media (max-width: 575.98px) and (orientation: portrait) {
  .layers-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem !important;
  }

  .layers-row .form-check-inline {
    margin-right: 0;
  }
}

/* Dès 768 px (tablette en portrait comme en paysage), plan et panneau côte à côte : le panneau défile seul. */
@media (min-width: 768px) {
  .editor-panel {
    position: sticky;
    top: 0.5rem;
    align-self: flex-start;
    max-height: calc(100vh - 1rem);
    overflow-y: auto;
  }
}

/* z-index: 0 crée un empilement propre au plan : la boussole et ses menus (z-index 1050+) passent sous la barre collante
   quand le plan défile dessous, au lieu de la recouvrir. */
.plan-frame {
  position: relative;
  z-index: 0;
}

/* Calque hors du SVG zoomable : il reste dans son coin pendant que le plan est zoomé ou défilé. */
.compass-anchor {
  position: absolute;
  z-index: 1051;
}

.plan-compass {
  display: block;
  width: 3.25rem;
  height: 3.25rem;
  background: rgba(251, 250, 246, 0.85);
  border: 1px solid var(--app-grey);
  border-radius: 50%;
  cursor: context-menu;
}

/* Focus clavier de la boussole : le même contour sauge que les éléments du plan, pas l'anneau bleu du navigateur. */
.plan-compass:focus {
  outline: none;
}

.plan-compass:focus-visible {
  outline: 3px solid var(--app-sage-dark);
  outline-offset: 2px;
}

.compass-menu {
  position: absolute;
  min-width: 12rem;
  font-size: 0.875rem;
}

.compass-menu .list-group-item.active {
  background: #4F6A4A;
  border-color: #4F6A4A;
}

/* Le menu s'ouvre vers l'intérieur du plan, quel que soit le coin. */
.compass-top-right .compass-menu,
.compass-top-left .compass-menu {
  top: calc(100% + 0.25rem);
}

.compass-bottom-right .compass-menu,
.compass-bottom-left .compass-menu {
  bottom: calc(100% + 0.25rem);
}

.compass-top-right .compass-menu,
.compass-bottom-right .compass-menu {
  right: 0;
}

.compass-top-left .compass-menu,
.compass-bottom-left .compass-menu {
  left: 0;
}

.planting-menu {
  position: absolute;
  z-index: 1052;
  min-width: 15rem;
  max-width: 15rem;
  font-size: 0.875rem;
}

.compass-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1050;
}

/* Les décalages à droite et en bas gardent la boussole à l'écart des barres de défilement (environ 15px). */
.compass-top-right {
  top: 0.4rem;
  right: 1.4rem;
}

.compass-top-left {
  top: 0.4rem;
  left: 0.4rem;
}

.compass-bottom-right {
  bottom: 1.4rem;
  right: 1.4rem;
}

.compass-bottom-left {
  bottom: 1.4rem;
  left: 0.4rem;
}

.plan-viewport {
  /* content-box : la bordure ne doit pas empiéter sur les 75vh, sinon une barre de défilement apparaît à 100 %. */
  box-sizing: content-box;
  overflow: auto;
  max-height: 75vh;
  /* Hors du jardin : papier clair finement hachuré, pour que le sol du contour se détache. */
  background: repeating-linear-gradient(45deg, #F8F6F0 0 9px, #ECE7DB 9px 10px);
  border: 1px solid var(--app-grey);
  border-radius: 0.5rem;
}

.plan-viewport-top {
  padding-top: 3.75rem;
}

.plan-viewport-bottom {
  padding-bottom: 4.75rem;
}

.plan-svg {
  display: block;
  margin: 0 auto;
  width: 100%;
  max-height: 75vh;
  /* Le sol défile et se zoome au doigt ; seuls les éléments déplaçables captent le geste (voir plus bas). */
  touch-action: manipulation;
  user-select: none;
}

/* Couleurs du plan SVG : en classes plutôt qu'en attributs, pour que le mode nuit puisse les redéfinir. */
:root {
  --plan-soil: #E3DCC8;
  --plan-grid: #D8D2C4;
  --plan-grid-major: #BFB6A2;
  --plan-bed: #C9AE8C;
  --plan-obstacle: #CDD1CA;
  --plan-hatch: #9A9F97;
  --plan-obstacle-text: #4A4E48;
  --plan-vertex: #FFFFFF;
  --plan-ink: #5B4A3A;
  --plan-conflict: #C0392B;
}

.plan-soil { fill: var(--plan-soil); }
.plan-grid-line { stroke: var(--plan-grid); }
.plan-grid-major { stroke: var(--plan-grid-major); }
.plan-hatch-bg { fill: var(--plan-obstacle); }
.plan-hatch-line { stroke: var(--plan-hatch); }
.plan-bed { fill: var(--plan-bed); }
.plan-zone-label { fill: var(--app-brown-dark); pointer-events: none; }
.plan-zone-tag { fill: #FBFAF6; fill-opacity: 0.9; }
.plan-outline,
.plan-zone-name { pointer-events: none; }
.plan-compass[role=img] { cursor: default; }

/* Plan partagé : accueil chaleureux, invitation discrète en fin de page, message clair pour un lien révoqué. */
.shared-welcome { color: var(--app-brown-dark); }
.shared-invite {
  background: #FBFAF6;
  border: 1px dashed var(--app-grey);
  border-radius: 0.75rem;
}
.shared-missing { max-width: 32rem; }
.share-confirm {
  padding: 0.5rem 0.75rem;
  background: #FBF1EE;
  border-radius: 0.5rem;
}
[data-bs-theme=dark] .shared-invite { background: #262A25; }
[data-bs-theme=dark] .share-confirm { background: #3A2B28; }
.plan-obstacle-label { fill: var(--plan-obstacle-text); }
.plan-vertex { fill: var(--plan-vertex); stroke: var(--app-brown-dark); }
.plan-stroke { stroke: var(--app-brown-dark); }
.plan-stroke-ink { stroke: var(--plan-ink); }
.plan-stroke-selected { stroke: var(--app-text); }
.plan-stroke-conflict { stroke: var(--plan-conflict); }
.plan-selection { stroke: var(--app-text); pointer-events: none; }
.compass-needle { fill: var(--app-brown-dark); }

.plan-svg [data-drag-id] {
  cursor: grab;
  touch-action: none;
}

/* Écran tactile : cibles d'au moins 44 px pour les petits boutons, les cases à cocher et leurs libellés. */
@media (pointer: coarse) {
  .btn-sm,
  .btn-group-sm > .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .form-check-input {
    width: 1.5rem;
    height: 1.5rem;
  }

  .form-check-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding-left: 0;
  }

  .form-check-inline .form-check-input {
    float: none;
    margin: 0;
  }

  /* Plus hauts que leur texte : sans flex, le libellé resterait collé en haut du bouton. */
  .btn-sm,
  .btn-group-sm > .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Élément du plan atteint au clavier : contour sauge, absent au clic de souris. */
.plan-svg [data-drag-id]:focus {
  outline: none;
}

.plan-svg [data-drag-id]:focus-visible {
  outline: 3px solid var(--app-sage-dark);
  outline-offset: 2px;
}

/* Alerte cliquable : se lit comme le texte de l'alerte, se souligne au survol ; elle sélectionne la culture en cause. */
.alert-target {
  padding: 0;
  color: inherit;
  text-align: start;
  text-decoration: underline dotted;
  text-underline-offset: 0.2em;
}

.alert-target:hover {
  color: inherit;
  text-decoration-style: solid;
}

/* Signal d'alerte sur l'onglet Cultures fermé : l'orange de récolte, seule couleur vive hors des cultures. */
.tab-alert {
  color: #8F500C;
  font-weight: 600;
}

[data-bs-theme=dark] .tab-alert {
  color: #E08E2B;
}

.placed-list .list-group-item.active {
  background: #4F6A4A;
  border-color: #4F6A4A;
}

.plan-svg text {
  pointer-events: none;
}

.crop-swatch {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  vertical-align: middle;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.valid.modified:not([type=checkbox]) {
  outline: 1px solid #6F8F68;
}

#blazor-error-ui {
  color-scheme: light only;
  background: lightyellow;
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  display: none;
  left: 0;
  padding: 0.6rem 1.25rem 0.7rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "Une erreur s'est produite."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* Bandeau du calendrier : une cellule par quinzaine, la période en terre en sauge clair, une marque par action. */
.cal-table th, .cal-table td { padding: 0.15rem; }
.cal-cell { min-width: 1.4rem; text-align: center; border-left: 1px solid #E3DCC8; }
/* Les cellules de Bootstrap peignent --bs-table-bg : c'est lui qu'on change, sinon la bande « en terre » reste invisible. */
.cal-table td.cal-ground { --bs-table-bg: #DCE7D8; }

/* Colonne des cultures figée : au défilement sur téléphone, on sait toujours quelle ligne on lit. */
.cal-table .cal-crop {
  position: sticky;
  left: 0;
  z-index: 1;
  white-space: nowrap;
  border-right: 1px solid #E3DCC8;
}

/* Quinzaine en cours : un filet sauge de chaque côté de la colonne, le mois en gras. */
.cal-table td.cal-now { box-shadow: inset 2px 0 0 var(--app-sage-dark), inset -2px 0 0 var(--app-sage-dark); }
.cal-table .cal-now-month { font-weight: 700; color: var(--app-sage-ink); }

/* Chaque action a sa forme en plus de sa couleur (lisible au soleil et sans distinguer les couleurs),
   et un contour sombre qui la détache de la case, quelle que soit la teinte. */
.cal-mark {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  vertical-align: middle;
  border: 1.5px solid rgba(40, 30, 20, 0.65);
}
.cal-mark-ground { background: #DCE7D8; border-radius: 2px; }
.cal-sow-shelter { background: #B89B7A; border-radius: 2px; }
.cal-sow { background: #6E8B3D; border-radius: 50%; }
.cal-plant { background: #3E7C59; width: 0.75rem; height: 0.75rem; transform: rotate(45deg); margin: 0.1rem; }
.cal-harvest { background: #E08E2B; width: 1.15rem; height: 0.65rem; border-radius: 0.35rem; }

/* Météo : bleu de pluie et or de soleil, distincts des marques du calendrier (la récolte est orange). */
:root {
  --weather-rain: #4F7FA8;
  --weather-sun: #C99A1E;
}
.weather-chart { width: 100%; max-width: 18rem; height: 2.75rem; }
.weather-chart .weather-rain { fill: var(--weather-rain); }
.weather-chart .weather-sun { fill: var(--weather-sun); }
.weather-key { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 2px; vertical-align: -0.05rem; }
.weather-key-rain { background: var(--weather-rain); }
.weather-key-sun { background: var(--weather-sun); }

/* Corbeille de l'année : le rouge d'erreur de DESIGN.md plutôt que le rouge de Bootstrap. */
.year-delete {
  --bs-btn-color: var(--app-error);
  --bs-btn-border-color: var(--app-error);
  --bs-btn-hover-bg: var(--app-error);
  --bs-btn-hover-border-color: var(--app-error);
  --bs-btn-active-bg: var(--app-error);
  --bs-btn-active-border-color: var(--app-error);
}
.weather-key + .weather-key { margin-left: 1px; }
.weather-key-usual { display: inline-block; width: 0.9rem; height: 2px; background: var(--app-text); opacity: 0.6; vertical-align: middle; }
.weather-source { font-size: 0.75rem; }
.cal-table td.weather-cell { height: 1.6rem; vertical-align: bottom; position: relative; }
/* Estimation (moyenne des années passées) : même couleur, en clair. Trait : la moyenne, sous une vraie valeur. */
.weather-estimate { opacity: 0.35; }
.weather-chart .weather-usual { fill: var(--app-text); opacity: 0.6; }
.weather-chart-wrap { position: relative; display: inline-flex; width: 100%; max-width: 18rem; cursor: zoom-in; border-radius: 2px; }
.weather-chart-wrap:focus-visible { outline: 3px solid var(--app-sage-dark); outline-offset: 2px; }

/* Vue agrandie de l'année : surgit au survol ou au focus du mini-graphique, quinzaines en lignes, valeurs dans les barres. */
.weather-popover {
  display: none;
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  z-index: 1060;
  width: min(36rem, calc(100vw - 2rem));
  padding: 0.75rem;
  background: var(--bs-body-bg);
  border: 1px solid var(--app-grey);
  border-radius: 0.5rem;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.18);
  font-size: 0.72rem;
  cursor: default;
}
.weather-chart-wrap:hover .weather-popover,
.weather-chart-wrap:focus-within .weather-popover { display: block; }
.weather-pop-title { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.weather-pop-grid { display: grid; grid-template-columns: 8.5rem 1fr 1fr; gap: 0.15rem 0.75rem; align-items: center; }
.weather-pop-axis { display: block; border-bottom: 1px solid var(--app-grey); padding-bottom: 0.15rem; }
.weather-pop-axis-title { display: block; font-weight: 600; }
.weather-pop-ticks { display: flex; justify-content: space-between; color: var(--app-grey-dark); }
.weather-pop-label { white-space: nowrap; color: var(--app-text); }
.weather-pop-cell { display: block; }
.weather-pop-bar {
  display: block;
  height: 0.8rem;
  min-width: 2.6rem;
  padding: 0 0.25rem;
  border-radius: 0 2px 2px 0;
  line-height: 0.8rem;
  white-space: nowrap;
  text-align: right;
}
.weather-pop-rain { background: var(--weather-rain); color: #fff; }
.weather-pop-sun { background: var(--weather-sun); color: #2B2620; }
/* Estimation : la même couleur éclaircie (texte foncé lisible), plutôt qu'une transparence qui pâlirait la valeur. */
.weather-pop-rain.weather-pop-estimate { background: color-mix(in srgb, var(--weather-rain) 35%, var(--bs-body-bg)); color: var(--app-text); }
.weather-pop-sun.weather-pop-estimate { background: color-mix(in srgb, var(--weather-sun) 35%, var(--bs-body-bg)); color: var(--app-text); }
.weather-pop-partial { outline: 1px dashed var(--app-text); outline-offset: -1px; }
/* Moyenne : barre fine grise sous la valeur, de la longueur de la moyenne ; les deux longueurs se comparent ligne à ligne. */
.weather-pop-usual { display: block; height: 0.25rem; margin-top: 0.1rem; background: var(--app-grey-dark); border-radius: 0 2px 2px 0; }
.weather-key-usual-bar { display: inline-block; width: 0.9rem; height: 0.25rem; background: var(--app-grey-dark); vertical-align: middle; }
.weather-pop-legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-top: 0.5rem; color: var(--app-grey-dark); }
.weather-key-partial { display: inline-block; width: 0.7rem; height: 0.7rem; outline: 1px dashed var(--app-text); outline-offset: -1px; vertical-align: -0.05rem; }
.weather-usual-mark { position: absolute; left: 15%; right: 15%; height: 2px; background: var(--app-text); opacity: 0.6; }
.weather-bar { display: block; width: 60%; margin: 0 auto; border-radius: 2px 2px 0 0; }
.weather-bar.weather-rain { background: var(--weather-rain); }
.weather-bar.weather-sun { background: var(--weather-sun); }
.cal-table .weather-row-last > * { border-bottom: 2px solid #E3DCC8; }

/* Téléphone : la grille montre trois mois autour d'aujourd'hui, sauf si l'on a demandé l'année entière. */
@media (max-width: 575.98px) {
  .cal-table:not(.cal-full) .cal-far { display: none; }
  .cal-table .cal-crop { white-space: normal; max-width: 9rem; }
}

/* Curseur de quinzaine : graduations sous le range, alignées sur les positions du curseur. */
.period-slider { position: relative; padding-bottom: 1.4rem; container-type: inline-size; }
.period-slider .form-range { display: block; }
/* Flèches ‹ › : au moins 24 px de large, même à la souris (WCAG 2.2, taille de cible). */
.period-nav .btn { min-width: 2rem; }
.period-ticks { position: absolute; left: 0; right: 0; top: 1.3rem; height: 1.2rem; }
.period-tick { position: absolute; top: 0; width: 1px; height: 0.3rem; background: #9A9F97; }
.period-tick-major { height: 0.5rem; background: #5B4A3A; }
.period-tick-label { position: absolute; top: 0.5rem; left: 0; transform: translateX(-50%); font-size: 0.65rem; color: #5F665C; white-space: nowrap; }
@container (max-width: 36rem) { .period-tick-alt .period-tick-label { display: none; } }

/* Pied de page et page légale. */
.app-footer { border-top: 1px solid #E3DCC8; color: #5F665C; }
.legal-page { max-width: 52rem; }

/* Mode nuit (data-bs-theme posé par js/theme.js) : Bootstrap change ses propres couleurs, la palette de l'application suit. */
.theme-icon-dark { display: none; }
[data-bs-theme=dark] .theme-icon-light { display: none; }
[data-bs-theme=dark] .theme-icon-dark { display: inline; }

[data-bs-theme=dark] {
  --app-cream: #1E211D;
  --app-sage: #33402F;
  --app-sage-dark: #6F8F68;
  --app-sage-ink: #9DC094;
  --app-error: #F2837A;
  --app-grey: #4A4E48;
  --app-brown: #7D6247;
  --app-brown-dark: #D8BE9C;
  --app-text: #E4E0D6;
  --bs-body-bg: var(--app-cream);
  --bs-body-color: var(--app-text);
  --bs-link-color: #9DC094;
  --bs-link-color-rgb: 157, 192, 148;
  --bs-link-hover-color: #B8D6B0;
  --bs-link-hover-color-rgb: 184, 214, 176;
  --plan-soil: #34372F;
  --plan-grid: #3F433A;
  --plan-grid-major: #535847;
  --plan-bed: #6B5843;
  --plan-obstacle: #3A3E38;
  --plan-hatch: #565C53;
  --plan-obstacle-text: #C9CCC4;
  --plan-vertex: #262A25;
  --plan-ink: #C9B79F;
  --plan-conflict: #E0614F;
  color-scheme: dark;
}

[data-bs-theme=dark] ::selection { background: #3A4A36; }
[data-bs-theme=dark] .app-card { background: #262A25; }
[data-bs-theme=dark] .garden-thumb { background: #2A2E28; }
[data-bs-theme=dark] .garden-card-new:hover,
[data-bs-theme=dark] .garden-card-new:focus-visible { background: #262A25; }
[data-bs-theme=dark] .form-control::placeholder { color: #8E938B; }
/* Mode nuit : le bouton principal garde son fond, un liseré plus clair le détache des cartes sombres. */
[data-bs-theme=dark] .btn-primary { --bs-btn-border-color: #6F8F68; --bs-btn-hover-border-color: #6F8F68; }
[data-bs-theme=dark] .app-card .card-header { background: #30352E; }
[data-bs-theme=dark] .plan-viewport { background: repeating-linear-gradient(45deg, #232621 0 9px, #2E322C 9px 10px); }
[data-bs-theme=dark] .plan-zone-tag { fill: #262A25; }
[data-bs-theme=dark] .plan-compass { background: rgba(38, 42, 37, 0.85); }
[data-bs-theme=dark] .cal-cell { border-left-color: #3A3F38; }
[data-bs-theme=dark] .cal-table td.cal-ground { --bs-table-bg: #3A4A36; }
[data-bs-theme=dark] .cal-mark-ground { background: #3A4A36; }
[data-bs-theme=dark] .cal-table .cal-crop { border-right-color: #3A3F38; }
/* Mode nuit : teintes d'action éclaircies et contour clair, pour garder la pastille lisible sur le fond sombre. */
[data-bs-theme=dark] .cal-mark { border-color: rgba(240, 236, 226, 0.75); }
[data-bs-theme=dark] .cal-sow-shelter { background: #CBB08F; }
[data-bs-theme=dark] .cal-sow { background: #8DAE57; }
[data-bs-theme=dark] .cal-plant { background: #5FA57C; }
[data-bs-theme=dark] .cal-harvest { background: #F0A04B; }
[data-bs-theme=dark] { --weather-rain: #7FA9CF; --weather-sun: #E2B84A; }
/* Bleu de pluie éclairci la nuit : le texte des barres passe en foncé pour rester lisible. */
[data-bs-theme=dark] .weather-pop-rain { color: #1E211D; }
[data-bs-theme=dark] .weather-popover { box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.6); }
[data-bs-theme=dark] .cal-table .weather-row-last > * { border-bottom-color: #3A3F38; }
[data-bs-theme=dark] .alert-info { --bs-alert-bg: #3A4A36; --bs-alert-border-color: #4F6A4A; }
[data-bs-theme=dark] .period-tick-major { background: #C9B79F; }
[data-bs-theme=dark] .period-tick-label,
[data-bs-theme=dark] .app-footer { color: #A9ADA6; }
[data-bs-theme=dark] .app-footer { border-top-color: #3A3F38; }
[data-bs-theme=dark] .app-navbar .navbar-brand { color: var(--app-brown-dark); }
[data-bs-theme=dark] .btn-outline-secondary {
  --bs-btn-color: #A9ADA6;
  --bs-btn-hover-color: var(--app-text);
  --bs-btn-hover-bg: #4A4E48;
  --bs-btn-hover-border-color: #4A4E48;
  --bs-btn-active-color: var(--app-text);
  --bs-btn-active-bg: #565C53;
  --bs-btn-active-border-color: #565C53;
  --bs-btn-disabled-color: #A9ADA6;
}

/* « Plus d'options » des champs d'une culture : un lien sauge discret, pas une carte de plus. */
.planting-more > summary { color: var(--app-sage-ink); cursor: pointer; width: fit-content; }
