@font-face {
  font-family: "Grasse";
  src: url("grasse.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg: #f0eae7;
  --ink: #4a4e57;
  --muted: #7a7e86;
  --green: #3b7d32;
  --soft: #c9ddb9;
  --line: #86ab69;
  --lsoft: #e4e9de;
  --alert: #c4683a;
  --card: #ffffff;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

.grasse { font-family: "Grasse", Georgia, serif; font-weight: normal; letter-spacing: 0.02em; }

h1, h2, h3 { font-family: "Grasse", Georgia, serif; font-weight: normal; color: var(--green); margin: 0; }
h1 { font-size: 30px; line-height: 1.1; }
h2 { font-size: 22px; margin-bottom: 10px; }
h3 { font-size: 16px; margin: 18px 0 8px; }

a { color: var(--green); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 18px 140px; }

header.top {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding-bottom: 18px; border-bottom: 1px solid var(--soft); margin-bottom: 22px;
}
header.top img { height: 64px; }
header.top .sous { color: var(--muted); font-size: 14px; }

.card {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03); margin-bottom: 18px;
}

.event-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.event-grid .lab { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.event-grid .val { font-size: 17px; font-weight: 600; margin-top: 2px; }
.event-grid .val.min { color: var(--green); }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
input, select, textarea {
  font: inherit; color: var(--ink); width: 100%;
  padding: 10px 12px; border: 1px solid #d7d4d0; border-radius: 10px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--soft); border-color: var(--line); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 999px;
  padding: 11px 20px; background: var(--green); color: #fff; text-decoration: none; display: inline-block;
}
button.sec, .btn.sec { background: var(--lsoft); color: var(--green); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* Onglets Boissons / Nourriture */
.tabs { display: flex; gap: 8px; margin: 8px 0 14px; flex-wrap: wrap; }
.tabs button { background: var(--lsoft); color: var(--green); }
.tabs button.on { background: var(--green); color: #fff; }

.sec-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.sec-nav a {
  font-size: 13px; text-decoration: none; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--soft); color: var(--green); background: #fff;
}

/* Lignes de la carte */
.item { padding: 10px 0; border-top: 1px solid var(--lsoft); }
.item:first-of-type { border-top: 0; }
.item .nom { font-weight: 600; }
.fmt {
  display: grid; grid-template-columns: 1fr 70px 92px 180px 90px; gap: 10px; align-items: center;
  margin-top: 6px; font-size: 14px;
}
.fmt .f { color: var(--muted); }
.fmt .p { text-align: right; }
.fmt .t { text-align: right; font-weight: 600; color: var(--green); }
.fmt.actif { background: #f6f9f2; border-radius: 8px; }
.qty { display: flex; align-items: center; border: 1px solid #d7d4d0; border-radius: 999px; overflow: hidden; background: #fff; }
.qty button { background: transparent; color: var(--green); padding: 6px 10px; border-radius: 0; font-size: 16px; line-height: 1; }
.qty input { border: 0; width: 100%; text-align: center; padding: 6px 0; border-radius: 0; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mode { display: flex; border: 1px solid var(--soft); border-radius: 999px; overflow: hidden; }
.mode button { flex: 1; padding: 6px 4px; font-size: 12px; border-radius: 0; background: #fff; color: var(--green); font-weight: 600; }
.mode button.on { background: var(--green); color: #fff; }
.verif { font-size: 11px; color: var(--alert); margin-left: 6px; }

/* Barre du total, fixe en bas */
.totalbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: #fff; border-top: 1px solid var(--soft); box-shadow: 0 -6px 18px rgba(0,0,0,0.05);
}
.totalbar .in {
  max-width: 1080px; margin: 0 auto; padding: 12px 18px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: space-between;
}
.jauge { flex: 1; min-width: 220px; }
.jauge .bar { height: 10px; background: var(--lsoft); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.jauge .bar div { height: 100%; background: var(--line); width: 0; transition: width 0.25s; }
.jauge .bar div.ok { background: var(--green); }
.jauge .msg { font-size: 13px; color: var(--muted); }
.jauge .msg b { color: var(--alert); }
.jauge .msg.ok b { color: var(--green); }
.tot { text-align: right; }
.tot .lab { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.tot .val { font-family: "Grasse", Georgia, serif; font-size: 28px; color: var(--green); line-height: 1; }

/* Récap */
table.recap { width: 100%; border-collapse: collapse; font-size: 14px; }
table.recap th { text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 6px 8px; border-bottom: 1px solid var(--soft); }
table.recap td { padding: 7px 8px; border-bottom: 1px solid var(--lsoft); vertical-align: top; }
table.recap td.n { text-align: right; white-space: nowrap; }
table.recap tr.grp td { font-family: "Grasse", Georgia, serif; color: var(--green); padding-top: 14px; border-bottom: 0; }
table.recap tfoot td { border: 0; padding: 6px 8px; }
table.recap tfoot tr.big td { font-size: 17px; font-weight: 700; color: var(--green); border-top: 2px solid var(--green); }
.vide { color: var(--muted); font-style: italic; }

.note { font-size: 12.5px; color: var(--muted); }
.erreur { background: #fbeee7; color: var(--alert); padding: 14px; border-radius: 10px; }
.ok-msg { background: #eef5e8; color: var(--green); padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.lien { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; word-break: break-all; background: var(--lsoft); padding: 10px; border-radius: 8px; }

/* Document PDF (visible seulement à l'impression) */
#doc { display: none; }

@media (max-width: 720px) {
  h1 { font-size: 24px; }
  .fmt { grid-template-columns: 1fr 64px 84px; }
  .fmt .mode { grid-column: 1 / 3; }
  .fmt .t { grid-column: 3; }
  .tot .val { font-size: 22px; }
}

/* Mise en page du devis PDF */
#doc { color: var(--ink); font-size: 11px; }
#doc .entete { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--green); padding-bottom: 10px; margin-bottom: 14px; }
#doc .entete img { height: 58px; }
#doc h1 { font-size: 24px; }
#doc .bloc { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
#doc .bloc > div { background: #f6f3f1; padding: 10px 12px; border-radius: 8px; line-height: 1.5; }
#doc .bloc b { display: block; font-family: "Grasse", Georgia, serif; font-weight: normal; color: var(--green); font-size: 13px; margin-bottom: 4px; }
#doc table.recap { font-size: 10.5px; }
#doc table.recap tr { page-break-inside: avoid; }
#doc .pied { margin-top: 18px; font-size: 9.5px; color: var(--muted); border-top: 1px solid var(--soft); padding-top: 8px; }

@media print {
  @page { size: A4; margin: 14mm 14mm 16mm; }
  html, body { background: #fff; }
  .ecran, .totalbar { display: none !important; }
  #doc { display: block; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ===== Page équipe : calendrier, moments ===== */
.eq-grid { display: grid; grid-template-columns: 1fr 340px; gap: 28px; }
@media (max-width: 760px) { .eq-grid { grid-template-columns: 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { background: var(--lsoft); color: var(--green); padding: 9px 16px; }
.chips button.on { background: var(--green); color: #fff; }
.row select { width: auto; min-width: 110px; }
.cal { border: 1px solid var(--soft); border-radius: 12px; padding: 10px; background: #fff; }
.cal-tete { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-tete span { color: var(--green); font-size: 18px; text-transform: capitalize; }
.cal-tete button { background: var(--lsoft); color: var(--green); padding: 4px 14px; font-size: 18px; }
.cal-grille { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-j { text-align: center; font-size: 11px; color: var(--muted); text-transform: uppercase; padding-bottom: 2px; }
.cal-grille button { padding: 0; height: 38px; border-radius: 10px; background: transparent; color: var(--ink); font-weight: 500; }
.cal-grille button:hover:not(:disabled) { background: var(--lsoft); }
.cal-grille button.we { color: var(--green); font-weight: 700; }
.cal-grille button.auj { outline: 1px solid var(--line); }
.cal-grille button.on { background: var(--green); color: #fff; }
.cal-grille button.passe { color: #c9c6c2; background: transparent; }
.date-choisie { margin-top: 8px; font-weight: 600; color: var(--muted); }
.date-choisie.ok::first-letter { text-transform: uppercase; }
.date-choisie.ok { color: var(--green); display: block; }

/* ===== Page client : catégories à gauche, une seule affichée ===== */
.event-line { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline; }
.event-line span { white-space: nowrap; }
.event-line b { color: var(--green); }
.carte-grid { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
.menu-sec { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px; }
.menu-sec .grp { font-family: "Grasse", Georgia, serif; color: var(--green); font-size: 14px; margin: 10px 0 4px; }
.menu-sec .grp:first-child { margin-top: 0; }
.menu-sec button {
  text-align: left; background: transparent; color: var(--ink); font-weight: 500; border-radius: 10px;
  padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.menu-sec button:hover { background: var(--lsoft); }
.menu-sec button.on { background: var(--green); color: #fff; }
.menu-sec .nb { font-size: 11px; background: var(--soft); color: var(--green); border-radius: 999px; padding: 1px 7px; font-weight: 700; }
.menu-sec button.on .nb { background: #fff; }
.carte-titre { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.carte-titre h3 { margin: 0; font-size: 20px; }
.ln {
  display: grid; grid-template-columns: 1fr 64px 112px 150px 78px; gap: 10px; align-items: center;
  padding: 7px 8px; border-top: 1px solid var(--lsoft); font-size: 14px;
}
.ln.suite { border-top: 0; padding-top: 0; }
.ln .nm { font-weight: 600; line-height: 1.25; }
.ln .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.ln .p { text-align: right; color: var(--muted); }
.ln .t { text-align: right; font-weight: 700; color: var(--green); }
.ln.actif { background: #f4f8ef; border-radius: 8px; }
.ln .qty button { padding: 5px 10px; }
.ln .qty input { padding: 5px 0; }
.ln .mode button { padding: 5px 2px; font-size: 11.5px; }
.compact h2 { margin-bottom: 6px; }
.recap-vide { color: var(--muted); font-style: italic; }

@media (max-width: 760px) {
  .carte-grid { grid-template-columns: 1fr; }
  .menu-sec { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .menu-sec .grp { display: none; }
  .menu-sec button { white-space: nowrap; border: 1px solid var(--soft); }
  .ln { grid-template-columns: 1fr 56px 100px; }
  .ln .mode { grid-column: 1 / 3; }
  .ln .t { grid-column: 3; }
}
.ln .nm small.desc { color: var(--ink); opacity: 0.75; margin: 2px 0 1px; font-size: 12.5px; }
table.recap tfoot tr.tva td { font-size: 12px; color: var(--muted); padding-top: 2px; padding-bottom: 2px; }
#recap { overflow-x: auto; }
@media (max-width: 760px) {
  .event-line span { white-space: normal; }
  table.recap { font-size: 12.5px; }
  table.recap th, table.recap td { padding: 6px 4px; }
  table.recap th { font-size: 10.5px; }
}
