/* Outil de comptoir. Concu pour etre lu debout, a bout de bras, dans une
   piece eclairee. Cibles tactiles genereuses, contraste maximal, une seule
   couleur d'accent : l'encre du tampon. */

:root {
  --paper: #fbfbf9;
  --ink: #000000;
  --stamp: #3b2fa8;
  --rule: #dddbd5;
  --muted: #6b6862;
  --alert: #a3121f;

  --gap: 1.5rem;
  --radius: 10px;
  --tap: 3.5rem; /* hauteur minimale d'une cible tactile */
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15141a;
    --ink: #f6f5f2;
    --stamp: #a79bff;
    --rule: #34313d;
    --muted: #9c98a6;
    --alert: #ff8e94;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: var(--gap) 1rem 4rem;
  background: var(--paper);
  color: var(--ink);
  font-family: Archivo, system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.shell {
  max-width: 34rem;
  margin: 0 auto;
}

h1,
h2 {
  font-stretch: 112%;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

h1 {
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  line-height: 1.1;
}

/* Sur l'ecran de recherche, le champ est le heros : le titre ne fait
   qu'orienter, il ne doit pas repousser la saisie vers le bas. */
h1.lede {
  font-size: 1.125rem;
  font-stretch: 100%;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

h2.sep {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  margin-bottom: 0.75rem;
}

h2 {
  font-size: 1.0625rem;
  font-stretch: 100%;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--stamp);
  outline-offset: 3px;
}

/* --- Messages ------------------------------------------------------- */

.notice {
  border-left: 4px solid var(--alert);
  padding: 0.75rem 1rem;
  margin: 0 0 var(--gap);
  color: var(--alert);
  font-weight: 600;
}

/* --- Recherche ------------------------------------------------------ */

.search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: var(--gap);
}

.search input {
  flex: 1;
  min-width: 0;
  height: 4rem;
  padding: 0 1rem;
  font: inherit;
  font-size: 1.5rem;
  font-stretch: 112%;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
}

.search input::placeholder {
  color: var(--muted);
}

/* La barre du rapport porte des champs etiquetes plutot qu'une seule
   saisie : ils gardent leur largeur propre et la ligne se replie au
   telephone au lieu de s'ecraser. */
.search {
  flex-wrap: wrap;
  align-items: end;
}

.search .field {
  flex: 1 1 10rem;
  margin-bottom: 0;
}

.search .field select {
  height: var(--tap);
  min-width: 9rem;
}

.search .field input {
  height: var(--tap);
  font-size: 1.125rem;
}

.search .act {
  flex: 0 0 auto;
  width: auto;
  padding-inline: 1.5rem;
  white-space: nowrap;
}

/* --- Liste de clients ----------------------------------------------- */

.results {
  list-style: none;
  margin: 0 0 var(--gap);
  padding: 0;
  border-top: 1px solid var(--rule);
}

.results li {
  border-bottom: 1px solid var(--rule);
}

/* Le dernier filet ferait doublon avec celui du separateur qui suit. */
.results li:last-child {
  border-bottom: 0;
}

.results a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--tap);
  padding: 0.75rem 0.25rem;
  text-decoration: none;
}

.results a:hover,
.results a:focus-visible {
  background: color-mix(in srgb, var(--stamp) 8%, transparent);
}

.results .who {
  font-stretch: 112%;
  font-weight: 700;
}

.results .tel {
  color: var(--muted);
  white-space: nowrap;
}

.blank {
  color: var(--muted);
  padding: 1rem 0 var(--gap);
  margin: 0;
}

/* --- Formulaires ---------------------------------------------------- */

.field {
  margin-bottom: 0.75rem;
}

.field label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
}

.field select,
.field input {
  width: 100%;
  height: var(--tap);
  padding: 0 1rem;
  font: inherit;
  font-size: 1.125rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
}

/* Le selecteur natif garde sa fleche : on n'habille que son cadre, pour
   qu'il s'aligne sur les autres champs sans perdre son comportement. */
.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentcolor 50%),
    linear-gradient(135deg, currentcolor 50%, transparent 50%);
  background-position: calc(100% - 1.125rem) 50%, calc(100% - 0.75rem) 50%;
  background-size: 0.375rem 0.375rem, 0.375rem 0.375rem;
  background-repeat: no-repeat;
  padding-right: 2.5rem;
}

.field .errorlist {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  color: var(--alert);
}

/* --- Boutons -------------------------------------------------------- */

.act {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
}

.act--main {
  min-height: 4rem;
  font-size: 1.5rem;
  font-stretch: 112%;
  color: var(--paper);
  background: var(--stamp);
  border-color: var(--stamp);
}

.act--ghost {
  min-height: 3rem;
  font-size: 1rem;
  border-width: 1px;
  border-color: var(--stamp);
  color: var(--stamp);
}

.act--quiet {
  min-height: 0;
  padding: 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  color: var(--muted);
  border: 0;
  text-decoration: underline;
  text-underline-offset: 4px;
  width: auto;
}

.act:hover {
  filter: brightness(1.08);
}

/* --- Ecran client --------------------------------------------------- */

.back {
  display: inline-block;
  min-height: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--muted);
}

.tel-big {
  margin: 0.25rem 0 var(--gap);
  color: var(--muted);
  font-size: 1.125rem;
}

/* La carte a tampons : l'objet en carton que le systeme remplace. */
.card {
  margin: 2rem 0 2.5rem;
}

/* Grille et non flex : une carte a tampons n'a jamais de rangee bancale.
   Bande de dix sur large, carte de cinq sur deux sur etroit. */
.stamps {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0.5rem;
  max-width: 27rem;
  margin-bottom: 0.625rem;
}

@media (max-width: 30rem) {
  .stamps {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    max-width: 14rem;
  }
}

.stamp {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--stamp);
}

.stamp--on {
  background: var(--stamp);
}

/* Unique mouvement de l'interface : le tampon qu'on vient de poser
   s'imprime, pour confirmer la saisie quand le barista va vite. */
.stamp--fresh {
  animation: press 420ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes press {
  0% {
    transform: scale(2.1);
    opacity: 0;
  }
  55% {
    transform: scale(0.92);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .stamp--fresh {
    animation: none;
  }
}

.tally {
  margin: 0;
  color: var(--muted);
}

.offer {
  margin: 0 0 0.375rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

.stack > * + * {
  margin-top: 1.5rem;
}

.till {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.till p {
  margin: 0 0 0.25rem;
  color: var(--muted);
}

/* --- Historique recent ----------------------------------------------- */

/* Sert surtout a reperer une double saisie : au comptoir, taper deux fois
   est l'erreur la plus probable. */
.history {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.history h2 {
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-stretch: 100%;
  font-weight: 600;
}

.history ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.history li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.375rem 0;
  border-bottom: 0;
  color: var(--muted);
}

.history .when {
  white-space: nowrap;
}

.history .how {
  color: var(--ink);
}

.history li .branch {
  flex: 0 0 auto;
  padding: 0 0.5rem;
  color: var(--stamp);
  border: 1px solid var(--stamp);
  border-radius: 999px;
  font-size: 0.8125rem;
  white-space: nowrap;
}

/* --- Bandeau de l'employe -------------------------------------------- */

/* Montre en permanence le cafe ou l'on travaille : c'est le garde-fou
   contre l'employe qui a change de succursale en cours de quart. */
.employee-session {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: var(--gap);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
}

.employee-session .who {
  font-weight: 600;
  color: var(--ink);
}

.employee-session .branch {
  padding: 0.125rem 0.625rem;
  color: var(--paper);
  background: var(--stamp);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.employee-session nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-left: auto;
}

.employee-session form {
  margin: 0;
}

/* --- Liste des actions d'un rapport ---------------------------------- */

/* Quatre colonnes depuis la v3 : l'instant, le client, le cafe qui a
   servi, et ce qui a ete servi. Une grille plutot qu'un flex, sinon le
   nom du client et le nom du cafe se marchent dessus. */
.history ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.history ol li {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: baseline;
  gap: 0.25rem 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.history ol time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.history ol strong {
  color: var(--ink);
  font-weight: 600;
}

.history ol .branch {
  justify-self: end;
  padding: 0.0625rem 0.5rem;
  color: var(--stamp);
  border: 1px solid var(--stamp);
  border-radius: 999px;
  font-size: 0.8125rem;
  white-space: nowrap;
}

@media (max-width: 40rem) {
  /* Au telephone, la ligne se replie en deux : l'instant et le client en
     haut, le cafe et le mode en dessous. */
  .history ol li {
    grid-template-columns: 1fr auto;
  }

  .history ol time {
    grid-column: 1;
  }

  .history ol strong {
    grid-column: 2;
    text-align: right;
  }
}
