/* La caisse installée : un écran de comptoir, au pouce, sur un téléphone. */

:root {
  --green: #0f7038;
  --green-dark: #0a4f27;
  --ink: #16211a;
  --muted: #5d6b62;
  --line: #d7e2d9;
  --paper: #fff;
  --wash: #f4f7f4;
  --warn: #8a4b06;
  --warn-wash: #fdf3e6;
  --bad: #9a1d1d;
  --bad-wash: #fdeeee;
  --ok-wash: #e9f5ec;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}

#app {
  max-width: 34rem;
  margin: 0 auto;
  padding: 0 0.75rem 3rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.chargement {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
}

.haut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 -0.75rem;
  padding: 0.7rem 0.9rem;
  padding-top: calc(0.7rem + env(safe-area-inset-top));
  background: var(--green);
  color: #fff;
}

.haut__marque {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.haut__marque span {
  font-size: 0.8rem;
  opacity: 0.85;
}

.haut__caisse select {
  min-height: 2.5rem;
  max-width: 11rem;
  border-radius: 8px;
  border: 0;
  padding: 0 0.5rem;
  font: inherit;
}

.barre {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.7rem;
  margin: 0 -0.75rem 0.75rem;
  padding: 0.55rem 0.9rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.barre__texte {
  color: var(--muted);
}

.chip {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.chip--ok {
  background: var(--ok-wash);
  color: var(--green-dark);
}

.chip--hors {
  background: var(--warn-wash);
  color: var(--warn);
}

.chip--refuse {
  background: var(--bad-wash);
  color: var(--bad);
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  margin-bottom: 0.75rem;
}

.panel h2 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.aide,
.muet {
  color: var(--muted);
  font-size: 0.9rem;
}

.aide {
  margin: 0 0 0.6rem;
}

.manque {
  color: var(--warn);
  font-weight: 700;
}

.message {
  margin: 0 0 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
}

.message--ok {
  background: var(--ok-wash);
  color: var(--green-dark);
}

.message--error {
  background: var(--bad-wash);
  color: var(--bad);
}

.champ {
  display: block;
  margin: 0 0 0.7rem;
}

.champ span {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.champ input {
  width: 100%;
  min-height: 3rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid #aebdb2;
  border-radius: 10px;
  font: inherit;
  font-size: 1.1rem;
}

.bouton {
  display: inline-block;
  min-height: 3rem;
  padding: 0.6rem 1.1rem;
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.bouton--grand {
  width: 100%;
  min-height: 3.6rem;
  font-size: 1.15rem;
}

.bouton--clair {
  background: var(--ok-wash);
  color: var(--green-dark);
}

.lien {
  background: none;
  border: 0;
  padding: 0.4rem 0;
  color: var(--green-dark);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.lien:disabled {
  color: var(--muted);
  text-decoration: none;
  cursor: default;
}

/* Les produits ------------------------------------------------------------- */

.produits,
.ventes {
  list-style: none;
  margin: 0;
  padding: 0;
}

.produit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.produit:last-child {
  border-bottom: 0;
}

.produit--choisi {
  background: var(--ok-wash);
  margin: 0 -0.9rem;
  padding-inline: 0.9rem;
}

.produit__nom {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.produit__nom .muet {
  font-size: 0.82rem;
}

.produit__qte {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: none;
}

/* Un prix que la direction a autorisé pour ce client : bien visible, jamais confondu avec la liste. */
.prix-autorise {
  color: var(--green-dark);
}

.panel--prix {
  border-color: var(--green);
}

.pas {
  width: 3rem;
  height: 3rem;
  border: 1px solid #aebdb2;
  border-radius: 10px;
  background: var(--paper);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.qte {
  min-width: 2rem;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
}

/* Le paiement -------------------------------------------------------------- */

.panel--paiement {
  border-color: var(--green);
}

.total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.7rem;
  font-size: 1.1rem;
}

.total strong {
  font-size: 1.7rem;
  font-variant-numeric: tabular-nums;
}

.modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

.mode {
  min-height: 3rem;
  border: 1px solid #aebdb2;
  border-radius: 10px;
  background: var(--paper);
  font: inherit;
  cursor: pointer;
}

.mode--choisi {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 700;
}

.monnaie {
  min-height: 1.4rem;
  margin: -0.2rem 0 0.7rem;
}

/* Les tickets du poste ------------------------------------------------------ */

.vente {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.2rem 0.6rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.vente__ticket {
  background: none;
  border: 0;
  padding: 0;
  color: var(--green-dark);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* L'état du poste : ventes et dépenses, en deux colonnes. */
.bilan {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  margin: 0.4rem 0;
}

.bilan dt {
  color: var(--muted);
}

.bilan dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.etat,
.vente__accord {
  grid-column: 1 / -1;
  font-size: 0.8rem;
}

.etat--attente {
  color: var(--warn);
}

.etat--ok {
  color: var(--green-dark);
}

.etat--signale {
  color: var(--warn);
  font-weight: 700;
}

.etat--refuse {
  color: var(--bad);
  font-weight: 700;
}

/* Le ticket ---------------------------------------------------------------- */

.voile {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: rgb(0 0 0 / 55%);
}

.fenetre {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 28rem;
  padding: 0.75rem;
  background: var(--wash);
}

.fenetre__titre {
  margin: 0 0 0.5rem;
}

.fenetre__ticket {
  flex: 1;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.fenetre__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
