/* Espace paramètres Dexyfun : mêmes couleurs que le site, mobile d'abord, aucune dépendance. */
:root {
  --lin: #fbf7f0;
  --sable: #f3eadb;
  --ficelle: #e6dac6;
  --cedre: #24332c;
  --cedre-doux: #5a675f;
  --olivier: #4e6b4f;
  --olivier-fonce: #3d5a3f;
  --olivier-clair: #dce6d5;
  --noyer: #8a5a2b;
  --miel: #f2be4a;
  --miel-fonce: #e0a82e;
  --terracotta: #b8492f;
  --ciel: #d6e7ec;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(36 51 44 / 6%), 0 4px 14px rgb(36 51 44 / 6%);
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--lin); color: var(--cedre); font: 16px/1.55 var(--sans); }
a { color: var(--olivier); text-underline-offset: 2px; }
a:hover { color: var(--olivier-fonce); }
h1, h2 { font-family: var(--serif); line-height: 1.2; font-weight: 600; }
h1 { font-size: 1.75rem; margin: 0 0 .4rem; }
h2 { font-size: 1.25rem; margin: 0 0 .75rem; }
:focus-visible { outline: 3px solid var(--miel); outline-offset: 2px; }
.muted { color: var(--cedre-doux); }
.lead { color: var(--cedre-doux); margin: 0 0 1.5rem; max-width: 60ch; }

/* --- Barre du haut et menu ------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem 1rem; background: var(--olivier); color: #fff;
}
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 800; }
.brand:hover { color: #fff; }
.brand img { border-radius: 8px; background: #fff; }
.brand small { font-weight: 600; opacity: .85; }

.mobile-nav summary {
  list-style: none; cursor: pointer; padding: .45rem .9rem; border-radius: 999px;
  border: 2px solid rgb(255 255 255 / 70%); font-weight: 700;
}
.mobile-nav summary::-webkit-details-marker { display: none; }
.mobile-nav[open] summary { background: rgb(255 255 255 / 15%); }
.mobile-nav nav {
  position: absolute; inset: 100% 0 auto; max-height: calc(100dvh - 60px); overflow: auto;
  padding: 1rem; background: #fff; color: var(--cedre); box-shadow: var(--shadow); border-bottom: 1px solid var(--ficelle);
}

.shell { display: block; }
.sidebar { display: none; }
main { padding: 1.25rem 1rem 6rem; max-width: 760px; }

.nav-heading { margin: 1rem 0 .3rem; font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--cedre-doux); }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .55rem .7rem; border-radius: 10px; color: var(--cedre); text-decoration: none; font-weight: 600;
}
.nav-list a:hover { background: var(--sable); }
.nav-list a.active { background: var(--olivier-clair); color: var(--olivier-fonce); }
.logout { margin-top: 1rem; }

@media (min-width: 960px) {
  .mobile-nav { display: none; }
  .shell { display: grid; grid-template-columns: 290px 1fr; }
  .sidebar {
    display: block; position: sticky; top: 56px; align-self: start; height: calc(100dvh - 56px); overflow: auto;
    padding: 1rem; border-right: 1px solid var(--ficelle); background: #fff;
  }
  main { padding: 2rem 2.5rem 4rem; }
}

/* --- Éléments --------------------------------------------------------- */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-bottom: 1.25rem; }
.card-warn { border-left: 5px solid var(--miel); }
.card ul { padding-left: 1.2rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: .7rem 1.4rem;
  border: 0; border-radius: 999px; background: var(--miel); color: var(--cedre); font: 800 1rem var(--sans);
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--miel-fonce); color: var(--cedre); }
.btn-secondary { background: transparent; border: 2px solid var(--olivier); color: var(--olivier); }
.btn-secondary:hover { background: var(--olivier-clair); color: var(--olivier-fonce); }
.btn-link { background: none; border: 0; padding: .3rem 0; color: var(--olivier); font: 600 .95rem var(--sans); text-decoration: underline; cursor: pointer; }

.flash { padding: .8rem 1rem; border-radius: 10px; margin: 0 0 1.25rem; font-weight: 600; }
.flash-ok { background: var(--olivier-clair); color: var(--olivier-fonce); }
.flash-error { background: #f8e1da; color: #8c3320; }

.tag { display: inline-block; padding: .1rem .55rem; border-radius: 999px; background: var(--sable); color: var(--cedre-doux); font-size: .78rem; font-weight: 700; white-space: nowrap; }
.tag-todo { background: #fbe9c4; color: #7a5400; }
.tag-proposal { background: var(--ciel); color: #24546f; }
.count { min-width: 2.4rem; text-align: center; padding: .05rem .45rem; border-radius: 999px; background: var(--sable); color: var(--cedre-doux); font-size: .8rem; font-weight: 800; }
.count-ok { background: var(--olivier-clair); color: var(--olivier-fonce); }

progress { width: 100%; height: 12px; accent-color: var(--olivier); }
.progress-list { list-style: none; padding: 0 !important; margin: 1rem 0 0; }
.progress-list li { display: flex; justify-content: space-between; align-items: center; padding: .45rem 0; border-top: 1px solid var(--ficelle); }

/* --- Formulaires ------------------------------------------------------ */
.form { display: grid; gap: 1rem; }
.stack { display: grid; gap: .9rem; }
.field { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.field-error { box-shadow: 0 0 0 2px var(--terracotta); }
.field-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .3rem .75rem; margin-bottom: .45rem; }
.label { font-weight: 800; }
.meta { font-size: .8rem; color: var(--cedre-doux); }
.help { margin: -.15rem 0 .55rem; font-size: .88rem; color: var(--cedre-doux); }
.error { margin: .45rem 0 0; color: #8c3320; font-weight: 700; font-size: .9rem; }

label { display: grid; gap: .3rem; font-weight: 700; }
input:not([type=radio], [type=checkbox]), textarea {
  width: 100%; min-height: 48px; padding: .65rem .8rem; border: 1.5px solid var(--ficelle); border-radius: 10px;
  background: var(--lin); color: var(--cedre); font: 400 1rem/1.45 var(--sans);
}
textarea { resize: vertical; }
input:focus, textarea:focus { border-color: var(--olivier); background: #fff; outline: none; box-shadow: 0 0 0 3px var(--olivier-clair); }
[aria-invalid=true] { border-color: var(--terracotta) !important; }
.with-unit { display: flex; align-items: center; gap: .5rem; max-width: 16rem; }
.with-unit span { font-weight: 800; color: var(--cedre-doux); }

.choices { display: grid; gap: .4rem; }
.choice {
  display: flex; align-items: flex-start; gap: .6rem; padding: .6rem .75rem; border: 1.5px solid var(--ficelle);
  border-radius: 10px; font-weight: 600; cursor: pointer; background: var(--lin);
}
.choice:has(input:checked) { border-color: var(--olivier); background: var(--olivier-clair); }
.choice input { width: 1.2rem; height: 1.2rem; margin: .15rem 0 0; accent-color: var(--olivier); flex: none; }
.choice-clear { font-weight: 500; color: var(--cedre-doux); }

.savebar {
  position: sticky; bottom: 0; z-index: 5; padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
  margin: 0 -1rem; background: rgb(251 247 240 / 96%); border-top: 1px solid var(--ficelle);
}
.savebar .btn { width: 100%; }
@media (min-width: 640px) {
  .savebar { margin: 0; border: 0; background: none; padding: .5rem 0; }
  .savebar .btn { width: auto; }
}

/* --- Produits --------------------------------------------------------- */
.product-list { list-style: none; padding: 0 !important; margin: 0; }
.product-row { display: flex; align-items: center; gap: .8rem; padding: .6rem 0; border-top: 1px solid var(--ficelle); color: var(--cedre); text-decoration: none; }
.product-list li:first-child .product-row { border-top: 0; }
.product-row img, .thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--sable); flex: none; }
.product-text { flex: 1; display: grid; min-width: 0; }
.product-text small { color: var(--cedre-doux); font-size: .85rem; }
.product-row:hover strong { text-decoration: underline; }
.product-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.25rem; }
.product-head img { width: 96px; height: 96px; border-radius: var(--radius); object-fit: cover; flex: none; }
.product-head p { margin: .2rem 0; }
.crumbs { margin: 0 0 .5rem; font-size: .9rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin: 1.5rem 0; font-weight: 700; }

/* --- Historique ------------------------------------------------------- */
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.history li { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem 1rem; }
.card .history li { box-shadow: none; border: 1px solid var(--ficelle); }
.history-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem .75rem; }
.diff { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem; margin-top: .4rem; white-space: pre-line; }
.diff del { color: #8c3320; background: #f8e1da; padding: .05rem .35rem; border-radius: 6px; }
.diff ins { color: var(--olivier-fonce); background: var(--olivier-clair); padding: .05rem .35rem; border-radius: 6px; text-decoration: none; }
.comment-text { margin: .4rem 0 0; color: var(--cedre-doux); font-style: italic; }

.knowledge {
  white-space: pre-wrap; word-break: break-word; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.1rem; font: .88rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* --- Connexion -------------------------------------------------------- */
.login-body { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.login { width: min(100%, 380px); background: #fff; border-radius: 20px; box-shadow: var(--shadow); padding: 2rem 1.5rem; text-align: center; }
.login img { border-radius: 14px; }
.login .stack { text-align: left; margin-top: 1rem; }
.login .btn { width: 100%; }

/* --- Comptes ---------------------------------------------------------- */
.users { list-style: none; padding: 0 !important; margin: 0; }
.users li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; padding: .75rem 0; border-top: 1px solid var(--ficelle); }
.users li:first-child { border-top: 0; }
.user-actions { display: flex; gap: 1rem; }
.password { font: 700 1.4rem ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .05em; background: var(--lin); padding: .6rem .8rem; border-radius: 10px; user-select: all; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { margin-bottom: .4rem; }
