/* ═══════════════════════════════════════════════════════════════
   GASPARD — socle graphique commun aux applis (Gestion, Recettes)
   Repris du site gaspard-tours.fr : crème #FAF8F5, noir #1B1B1B,
   jaune #FDC516, Montserrat Black en majuscules, [ CROCHETS ],
   angles droits, bordures noires de 2 px. Grille de 4 px.
   ═══════════════════════════════════════════════════════════════ */

@font-face { font-family: "Montserrat"; font-weight: 700; font-display: swap; src: url("/shared/fonts/montserrat-700.woff") format("woff"); }
@font-face { font-family: "Montserrat"; font-weight: 800; font-display: swap; src: url("/shared/fonts/montserrat-800.woff") format("woff"); }
@font-face { font-family: "Montserrat"; font-weight: 900; font-display: swap; src: url("/shared/fonts/montserrat-900.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("/shared/fonts/inter-400.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("/shared/fonts/inter-500.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("/shared/fonts/inter-600.woff") format("woff"); }

:root {
  --cream: #FAF8F5;
  --paper: #FFFFFF;
  --sand: #F1EEE8;
  --ink: #1B1B1B;
  --ink-2: rgba(27, 27, 27, 0.64);
  --ink-3: rgba(27, 27, 27, 0.34);
  --hair: rgba(27, 27, 27, 0.12);
  --yellow: #FDC516;
  --yellow-soft: rgba(253, 197, 22, 0.35);
  --red: #C62828;

  --display: "Montserrat", "Arial Black", sans-serif;
  --text: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;

  --border: 2px solid var(--ink);
  --pad: 16px;
  --maxw: 720px;
  --tabbar-h: 60px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 16px/24px var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; border-radius: 0; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* ── Typo de marque ───────────────────────────── */
.caps { font-family: var(--display); text-transform: uppercase; }
.bracket {                     /* [ TITRE ] sur bandeau jaune, comme sur le site */
  display: inline-block;
  margin: 0;
  padding: 2px 10px 0;
  background: var(--yellow);
  font: 900 28px/38px var(--display);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.label {
  font: 800 12px/16px var(--display);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── Boutons & champs ─────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 24px;
  border: var(--border); background: var(--ink); color: var(--cream);
  font: 800 14px/16px var(--display); letter-spacing: 1px; text-transform: uppercase;
}
.btn:active { background: #000; }
.btn:disabled { background: #9B9B9B; border-color: #9B9B9B; cursor: default; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:active { background: var(--sand); }
.btn-block { width: 100%; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; margin-bottom: 8px; }
.input, .field input {
  width: 100%; height: 48px; padding: 0 14px;
  border: var(--border); background: var(--paper);
  font: 400 16px/24px var(--text); outline: 0;
}
.input:focus, .field input:focus { box-shadow: 0 0 0 3px var(--yellow); }

.form-error { margin: 0 0 16px; font: 500 14px/20px var(--text); color: var(--red); }
.form-error:empty { display: none; }

.close-btn {                   /* bouton rond noir à croix jaune, comme les fenêtres du site */
  width: 36px; height: 36px; border: 0; border-radius: 50% !important;
  background: var(--ink); color: var(--yellow);
  display: grid; place-items: center; flex: none;
}
.close-btn svg { width: 14px; height: 14px; }

/* ── Connexion ────────────────────────────────── */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 32px 24px; }
.login-card { width: 100%; max-width: 360px; }
.login-brand { text-align: center; margin-bottom: 40px; }
.login-brand img { width: 88px; height: 88px; display: block; margin: 0 auto 24px; }
.login-brand .bracket { font-size: 24px; line-height: 34px; }
.login-brand p { margin: 12px 0 0; color: var(--ink-2); }

/* ── Barre du haut ────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--cream);
  padding-top: env(safe-area-inset-top);
  transition: box-shadow .2s;
}
.topbar.is-scrolled { box-shadow: 0 2px 0 var(--ink); }
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; height: 56px;
  padding: 0 max(var(--pad), env(safe-area-inset-right)) 0 max(var(--pad), env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-brand img { width: 32px; height: 32px; }
.topbar-brand .label { letter-spacing: 1.5px; }
.square-btn {
  width: 40px; height: 40px; border: 0; background: var(--ink); color: var(--yellow);
  display: grid; place-items: center;
}
.square-btn svg { width: 20px; height: 20px; }

/* ── Page ─────────────────────────────────────── */
.page {
  max-width: var(--maxw); margin: 0 auto;
  padding: 8px max(var(--pad), env(safe-area-inset-right)) calc(var(--tabbar-h) + 48px + env(safe-area-inset-bottom)) max(var(--pad), env(safe-area-inset-left));
}
.page-head { margin-bottom: 20px; }
.page-head p { margin: 12px 0 0; color: var(--ink-2); font: 500 14px/20px var(--text); }

.empty { text-align: center; padding: 56px 16px; border: 2px dashed var(--ink-3); }
.empty .label { display: block; margin-bottom: 8px; }
.empty p { margin: 0 auto; max-width: 340px; color: var(--ink-2); font-size: 15px; line-height: 22px; }

/* ── Barre d'onglets ──────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--cream);
  border-top: var(--border);
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.tabbar-inner { max-width: var(--maxw); margin: 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.tab {
  position: relative; height: var(--tabbar-h);
  border: 0; background: transparent; color: var(--ink-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font: 800 10px/12px var(--display); letter-spacing: 1px; text-transform: uppercase;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: miter; stroke-linecap: square; }
.tab.is-active { color: var(--ink); }
.tab.is-active::before { content: ""; position: absolute; top: -2px; left: 25%; right: 25%; height: 4px; background: var(--yellow); }

/* ── Liste type « carte » ─────────────────────── */
.section-label { display: flex; justify-content: space-between; align-items: baseline; margin: 28px 0 8px; }
.section-label span + span { color: var(--ink-3); }
.card { background: var(--paper); border: var(--border); }
.row {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 64px; padding: 12px 16px;
  border: 0; background: transparent; text-align: left;
}
.row + .row { border-top: 1px solid var(--hair); }
.row:active { background: var(--sand); }

/* ── Feuille (fiche) ──────────────────────────── */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(27, 27, 27, 0.5); animation: fade .2s ease; }
.sheet {
  position: fixed; z-index: 21; left: 0; right: 0; bottom: 0;
  top: calc(env(safe-area-inset-top) + 16px);
  display: flex; flex-direction: column;
  background: var(--cream); border-top: var(--border);
  animation: rise .32s cubic-bezier(.2, .9, .3, 1);
}
@media (min-width: 760px) {
  .sheet { top: 5vh; bottom: 5vh; left: 50%; right: auto; width: 600px; transform: translateX(-50%); border: var(--border); animation: pop .2s ease; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(100%); } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }
.sheet-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 16px 16px 20px;
}
.sheet-head .bracket { font-size: 20px; line-height: 30px; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 20px 24px; }
.sheet-foot {
  flex: none; padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 2px solid var(--ink); background: var(--cream);
}

/* ── Toast ────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; z-index: 30;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  padding: 12px 18px; background: var(--ink); color: var(--cream);
  font: 800 12px/16px var(--display); letter-spacing: 1px; text-transform: uppercase; white-space: nowrap;
  transition: opacity .2s, transform .2s;
}
.toast::before { content: "[ "; color: var(--yellow); }
.toast::after { content: " ]"; color: var(--yellow); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ── Compte ───────────────────────────────────── */
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; }
.kv + .kv { border-top: 1px solid var(--hair); }
.kv span:last-child { color: var(--ink-2); text-align: right; font-size: 15px; }
.kv .label { flex: none; padding-top: 2px; }
.account-actions { margin-top: 32px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
