/* Pains & Saveurs PRO — feuille de style commune */
:root {
  --green-deep: #1d4a3b;
  --green: #2f6b4f;
  --green-soft: #e6efe9;
  --cream: #f4efe6;
  --cream-input: #faf7f2;
  --line: #e4ddd0;
  --ink: #1c2a24;
  --muted: #7a847f;
  --banner-bg: #fbf3df;
  --banner-line: #ead9b0;
  --banner-ink: #7c5a25;
  --gold: #d4a24c;
  --danger: #b4463a;
  --danger-bg: #fbe9e6;
  --ok-bg: #e3f0e8;
  --ok-ink: #24583f;
  --pending-bg: #fbf3df;
  --pending-ink: #7c5a25;
  --radius: 28px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Manrope, Helvetica, Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-deep); text-decoration: underline; }
h1, h2, h3 { font-family: "Playfair Display", Georgia, serif; font-weight: 700; margin: 0 0 8px; letter-spacing: -.01em; }
h1 { font-size: 34px; }
h2 { font-size: 22px; }
h1 em, h2 em { font-style: italic; font-weight: 600; color: #8a6a2a; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---- Pages « carte » (connexion, inscription…) ---- */
body.card-page {
  background: var(--green-deep);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 16px;
}
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 44px 44px 36px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 30px 60px rgba(0,0,0,.25);
}
.card.wide { max-width: 560px; }
.card .logo { display: block; width: 140px; max-width: 60%; margin: 0 auto 16px; } /* v5.3 : un tiers plus petit */
.card .lead { text-align: center; color: var(--muted); font-size: 15px; margin-bottom: 22px; }
.card h1.title { text-align: center; font-size: 26px; margin-bottom: 6px; }

.banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--banner-bg); border: 1px solid var(--banner-line); color: var(--banner-ink);
  border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 22px;
}
.banner::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-top: 6px; flex: none; }
.banner strong { font-weight: 700; }

.alert { border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 18px; border: 1px solid transparent; }
.alert.error { background: var(--danger-bg); color: var(--danger); border-color: #f0c9c3; }
.alert.success { background: var(--ok-bg); color: var(--ok-ink); border-color: #c5dccd; }
.alert.info { background: var(--banner-bg); color: var(--banner-ink); border-color: var(--banner-line); }

label { display: block; font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.field { margin-bottom: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } .card { padding: 32px 22px 28px; } }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=search], input[type=url], textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--cream-input); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 80px; resize: vertical; }
input[type=date] { width: auto; min-width: 150px; padding: 10px 12px; }
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47,107,79,.15); }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: 16px; cursor: pointer;
  background: var(--green); color: #fff; border: 0; border-radius: 999px;
  padding: 15px 22px; width: 100%; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--green-deep); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #fff; color: var(--green); border: 1px solid var(--line); }
.btn.secondary:hover { background: var(--green-soft); }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid #f0c9c3; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.sm { width: auto; padding: 9px 14px; font-size: 14px; }
.btn.xs { width: auto; padding: 5px 11px; font-size: 12.5px; min-height: 0; } /* v6 */
.btn.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
.btn.ghost:hover { background: rgba(255,255,255,.1); }

.links { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; font-size: 14px; flex-wrap: wrap; }
.links.center { justify-content: center; }
.divider { height: 1px; background: var(--line); margin: 22px 0 18px; }

/* ---- Pages admin ---- */
body.admin-page { background: var(--cream); min-height: 100vh; }
.topbar {
  background: var(--green-deep); color: #fff; padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar .brand { display: flex; align-items: center; gap: 14px; }
.topbar .brand img { height: 46px; filter: brightness(0) invert(1); }
.topbar .brand .tag { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.topbar .who { font-size: 14px; opacity: .9; display: flex; align-items: center; gap: 14px; }
@media (min-width: 821px) {
  /* 12 entrées de menu : elles passent à la ligne au lieu d'élargir la page (défilement horizontal sur portable) */
  .topbar { flex-wrap: wrap; row-gap: 10px; }
  .topbar .brand { flex: none; }
  .topbar .who { flex: 1 1 520px; flex-wrap: wrap; justify-content: flex-end; gap: 6px; min-width: 0; }
  .topbar .who-name { margin-right: 8px; }
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 32px 24px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { color: var(--muted); margin: 0; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs a { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; color: var(--ink); }
.tabs a:hover { text-decoration: none; background: var(--green-soft); }
.tabs a.active { background: var(--green-deep); border-color: var(--green-deep); color: #fff; }
.tabs .count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: #fff; font-size: 12px; text-align: center; margin-left: 6px; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fbfaf7; }
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td .name { font-weight: 700; font-size: 15px; }
td .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.badge { display: inline-block; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700; }
.badge.pending { background: var(--pending-bg); color: var(--pending-ink); }
.badge.approved { background: var(--ok-bg); color: var(--ok-ink); }
.badge.rejected { background: var(--danger-bg); color: var(--danger); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { display: inline; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat .n { font-family: "Playfair Display", Georgia, serif; font-size: 28px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
@media (max-width: 820px) {
  table, thead, tbody, tr, td, th { display: block; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  td { border: 0; padding: 6px 16px; }
  td:empty { display: none; }
  /* étiquette de colonne (ajoutée automatiquement depuis l'en-tête du tableau) */
  td[data-label]::before {
    content: attr(data-label); display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase; color: var(--muted); margin-bottom: 2px;
  }
  td:first-child[data-label]::before { content: none; }
  td[style*="text-align:right"], td[style*="text-align: right"] { text-align: left !important; }
}

/* ---- v2 : compte client, pages légales, admin étendu ---- */
.card-footer { margin-top: 18px; text-align: center; font-size: 13px; color: rgba(255,255,255,.7); }
.card-footer a { color: rgba(255,255,255,.85); }
.card.doc { max-width: 760px; }
.card.doc h2 { font-size: 19px; margin-top: 22px; }
.card.doc p, .card.doc li { font-size: 15px; line-height: 1.6; }
.card.doc ul { padding-left: 22px; margin: 0 0 12px; }
.client-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; margin: -12px 0 20px; color: var(--muted); }
.client-bar span { font-weight: 700; color: var(--ink); }
.section { border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; margin-bottom: 18px; }
.section h2 { font-size: 20px; margin-bottom: 4px; }
.section .desc { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 500; margin: 0 0 16px; }
.check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.team { list-style: none; padding: 0; margin: 0 0 14px; }
.team li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.team li:last-child { border-bottom: 0; }
.team .who { display: flex; flex-direction: column; }
.team .who small { color: var(--muted); }
.topbar .who-name { margin-right: 6px; }
.topbar .btn.ghost.active { background: rgba(255,255,255,.18); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } .topbar { flex-direction: column; align-items: flex-start; } }
.journal td { font-size: 13px; }
.journal .act { font-weight: 700; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--green-soft); color: var(--ok-ink); margin-left: 6px; vertical-align: middle; }
.pill.warn { background: var(--pending-bg); color: var(--pending-ink); }
.pill.grey { background: #eee; color: #555; }
.danger-zone { border-color: #f0c9c3; }

/* --- v3 : commandes / production --- */
.order-day { margin-bottom: 26px; }
.order-day h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 20px; margin-bottom: 10px; }
.order-day h2 .pill { margin: 0; }
ul.lines { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; min-width: 260px; }
ul.lines li { display: flex; gap: 6px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
ul.lines li:last-child { border-bottom: 0; }
ul.lines.compact { margin: 0; min-width: 0; }
ul.lines.compact li { border: 0; padding: 1px 0; display: block; white-space: nowrap; }
.badge.cancelled { background: var(--danger-bg); color: var(--danger); }
.prod-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .prod-grid { grid-template-columns: 1fr; } }
.prod-grid td.num { text-align: right; font-family: monospace; font-size: 15px; }
.prod-grid td.num.big { font-weight: 700; font-size: 18px; color: var(--green-deep); }
.prod-grid td.num.warn { color: var(--pending-ink); font-weight: 700; }
.prod-grid tr.cat td { background: #fbfaf7; font-size: 11px; letter-spacing: .1em; font-weight: 700; color: var(--muted); padding: 8px 16px; }
.prod-grid tr.total td { font-weight: 700; background: #fbfaf7; }
@media print {
  .topbar, .no-print, .tabs, .alert { display: none !important; }
  body.admin-page { background: #fff; }
  .wrap { padding: 0; max-width: none; }
  .panel { border: 0; border-radius: 0; }
  .prod-grid { grid-template-columns: 1fr; }
}

/* --- v4 : téléphone (admin + pages client) --- */
@media (max-width: 820px) {
  .topbar { padding: 12px 14px 10px; flex-direction: column; align-items: stretch; gap: 10px; }
  .topbar .brand { justify-content: space-between; }
  .topbar .brand img { height: 36px; }
  .topbar .who {
    flex-wrap: nowrap; gap: 6px; opacity: 1; overflow-x: auto; scrollbar-width: none;
    margin: 0 -14px; padding: 0 28px 2px 14px; -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .topbar .who::-webkit-scrollbar { display: none; }
  .topbar .who-name { display: none; }
  .topbar .who .btn.sm { flex: none; padding: 9px 13px; font-size: 14px; min-height: 40px; white-space: nowrap; }
  .topbar .who .btn.ghost.active { background: #fff; color: var(--green-deep); border-color: #fff; }
  .wrap { padding: 20px 14px 50px; }
  h1 { font-size: 28px; }
  .btn.sm { min-height: 40px; }
  .actions .btn.sm, .toolbar .btn.sm { min-height: 42px; }
  .tabs a { padding: 10px 14px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .n { font-size: 24px; }
  input[type=checkbox] { width: 22px; height: 22px; }
  .client-bar { margin: -8px 0 18px; font-size: 14px; }
  .client-bar a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; font-weight: 700; }
  .client-bar span { flex: 1 0 100%; order: -1; font-size: 15px; }
  .card .logo { width: 115px; }
}
@media (max-width: 720px) {
  body.card-page { padding: 16px 10px 28px; place-items: start center; }
  .card { border-radius: 22px; }
}

/* v5.3 — œil « afficher le mot de passe » (assets/pw-eye.js) */
.pw-wrap { position: relative; display: block; }
.pw-wrap.inl { display: inline-block; vertical-align: middle; }
.pw-eye { position: absolute; top: 50%; right: 5px; transform: translateY(-50%); width: 38px; height: 38px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--muted, #6b7a72); cursor: pointer; display: grid; place-items: center; -webkit-tap-highlight-color: transparent; }
.pw-eye:hover { color: var(--green, #1d4a3b); background: rgba(29, 74, 59, .07); }
.pw-eye:focus-visible { outline: 2px solid var(--green, #1d4a3b); outline-offset: 1px; }
.pw-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.pw-eye.sm { width: 30px; height: 30px; right: 3px; }
.pw-eye.sm svg { width: 17px; height: 17px; }
input::-ms-reveal, input::-ms-clear { display: none; } /* Edge : pas de second œil */

/* =====================================================================
   v6.4 — RIDEAU : pages « carte » (connexion, inscription…) — les blocs arrivent l'un après l'autre,
   le bouton montre l'envoi ; sur téléphone, la connexion a un bandeau vert qui se déroule.
   ===================================================================== */
@keyframes psIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes psFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes psCurtainIn { from { clip-path: inset(0 0 100% 0 round 0 0 30px 30px); } to { clip-path: inset(0 0 0 0 round 0 0 30px 30px); } }
@keyframes psSpin { to { transform: rotate(360deg); } }
body.card-page .card > :nth-child(-n+12) { animation: psIn .42s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(.08s + var(--i, 0) * .06s); }
body.card-page .card > form { animation: none; }
body.card-page .card form > :nth-child(-n+8) { animation: psIn .42s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(.3s + var(--i, 0) * .06s); }
body.card-page .card > :first-child, body.card-page .card form > :first-child { --i: 0; }
body.card-page .card > :nth-child(2), body.card-page .card form > :nth-child(2) { --i: 1; }
body.card-page .card > :nth-child(3), body.card-page .card form > :nth-child(3) { --i: 2; }
body.card-page .card > :nth-child(4), body.card-page .card form > :nth-child(4) { --i: 3; }
body.card-page .card > :nth-child(5), body.card-page .card form > :nth-child(5) { --i: 4; }
body.card-page .card > :nth-child(6), body.card-page .card form > :nth-child(6) { --i: 5; }
body.card-page .card > :nth-child(7), body.card-page .card form > :nth-child(7) { --i: 6; }
body.card-page .card > :nth-child(8), body.card-page .card form > :nth-child(8) { --i: 7; }
body.card-page .card > :nth-child(9), body.card-page .card form > :nth-child(9) { --i: 8; }
body.card-page .card > :nth-child(n+10), body.card-page .card form > :nth-child(n+10) { --i: 9; }
.card .curtain .logo-w { display: none; }
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .3); border-top-color: #fff; animation: psSpin .8s linear infinite; }
@media (max-width: 720px) {
  body.card-page.login-page { background: var(--cream); padding: 0 0 28px; }
  body.card-page .card.login { background: transparent; box-shadow: none; border-radius: 0; padding: 0 16px 24px; max-width: none; }
  body.card-page .card.login > .curtain { margin: 0 -16px 20px; padding: 42px 32px 28px; background: var(--green-deep); color: #f4efe6; border-radius: 0 0 30px 30px; text-align: center; animation: psCurtainIn .55s cubic-bezier(.22, .9, .3, 1) both; }
  body.card-page .card.login > .curtain .logo { display: none; }
  body.card-page .card.login > .curtain .logo-w { display: block; width: 150px; max-width: 60%; margin: 0 auto 12px; animation: psFadeIn .4s ease .25s both; }
  body.card-page .card.login > .curtain .lead { margin: 0; color: rgba(244, 239, 230, .78); animation: psFadeIn .4s ease .35s both; }
  body.card-page .card.login input[type=email], body.card-page .card.login input[type=password], body.card-page .card.login input[type=text] { background: #fff; }
  body.card-page .card.login .btn { box-shadow: 0 10px 24px rgba(29, 74, 59, .28); }
  body.card-page .card.login .btn.secondary { box-shadow: none; background: transparent; border-color: #d9d2c4; }
  body.card-page .card.login .divider { background: #e6e1d8; }
}
@media (prefers-reduced-motion: reduce) {
  body.card-page .card > *, body.card-page .card form > *, .card .curtain, .card .curtain .logo-w, .card .curtain .lead { animation-duration: .001s !important; animation-delay: 0s !important; }
}
