:root {
  --fond: #f4f3ef;
  --carte: #ffffff;
  --texte: #1b1b19;
  --discret: #6b6a65;
  --trait: #d9d7cf;
  --accent: #185fa5;
  --accent-fond: #e6f1fb;
  --plein: #1b1b19;
  --sur-plein: #ffffff;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #141413;
    --carte: #1f1f1d;
    --texte: #f1efe8;
    --discret: #a3a199;
    --trait: #3a3936;
    --accent: #85b7eb;
    --accent-fond: #0c2f52;
    --plein: #f1efe8;
    --sur-plein: #141413;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#ecran {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

a { color: var(--accent); text-decoration: none; }
h1 { font-size: 18px; font-weight: 600; margin: 0; }
p { margin: 0; }
form { display: flex; flex-direction: column; gap: 14px; flex: 1; }

.tete { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 32px; }
.tete.jour a, .tete.jour span { font-size: 26px; width: 44px; text-align: center; line-height: 1; }
.tete.jour h1::first-letter { text-transform: uppercase; }

.discret { color: var(--discret); font-size: 13px; }
.note { color: var(--discret); font-size: 13px; text-align: center; }

.champ { display: flex; flex-direction: column; gap: 4px; }
.champ > span { font-size: 13px; color: var(--discret); }

input:not([type="file"]), button, .secondaire {
  font: inherit;
  color: inherit;
  min-height: 48px;
  border: 1px solid var(--trait);
  border-radius: 10px;
  background: var(--carte);
  padding: 10px 12px;
  width: 100%;
}
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { cursor: pointer; }

.montant { position: relative; }
.montant input { font-size: 28px; font-weight: 600; text-align: right; padding-right: 52px; min-height: 60px; }
.montant b { position: absolute; right: 14px; top: 50%; translate: 0 -50%; font-weight: 400; color: var(--discret); }

.choisir { text-align: left; }
.ajouter { color: var(--accent); }
.prise { border-style: dashed; text-align: center; min-height: 72px; }

.photo { display: flex; gap: 10px; align-items: center; }
.photo img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--trait); display: block; }

.segments { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--trait); border-radius: 10px; overflow: hidden; background: var(--carte); }
.segments button { border: 0; border-radius: 0; font-size: 14px; padding: 10px 2px; background: none; }
.segments button[aria-pressed="true"] { background: var(--accent-fond); color: var(--accent); font-weight: 600; }

.principal { margin-top: auto; background: var(--plein); color: var(--sur-plein); border-color: var(--plein); font-weight: 600; }
.secondaire { margin-top: auto; display: block; text-align: center; color: var(--texte); line-height: 26px; }
.lien { border: 0; background: none; min-height: 0; padding: 0; text-align: left; width: auto; align-self: flex-start; }

.total { background: var(--carte); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; }
.total small { color: var(--discret); font-size: 13px; }
.total strong { font-size: 24px; font-weight: 600; }

.lignes { display: flex; flex-direction: column; }
.ligne { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--trait); color: var(--texte); }
.ligne span:first-child { display: flex; flex-direction: column; min-width: 0; }
.ligne b { font-weight: 500; overflow-wrap: anywhere; }
.ligne small { color: var(--discret); font-size: 13px; overflow-wrap: anywhere; }
.somme { white-space: nowrap; font-variant-numeric: tabular-nums; }

dialog.choix {
  width: min(480px, 100%);
  max-width: 100%;
  max-height: 85dvh;
  margin: auto auto 0;
  border: 0;
  border-radius: 16px 16px 0 0;
  padding: 16px;
  background: var(--fond);
  color: var(--texte);
}
dialog.choix[open] { display: flex; flex-direction: column; gap: 12px; }
dialog.choix::backdrop { background: rgb(0 0 0 / 0.45); }
dialog.choix header { display: flex; justify-content: space-between; align-items: center; }
dialog.choix header button { width: auto; min-height: 36px; padding: 4px 12px; }
dialog.choix ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
dialog.choix li { padding: 14px 4px; border-top: 1px solid var(--trait); cursor: pointer; }

.pastille { font-size: 12px; color: var(--discret); border: 1px solid var(--trait); border-radius: 999px; padding: 2px 10px; white-space: nowrap; margin-left: auto; }
.ligne .pastille { align-self: flex-start; margin: 4px 0 0; font-size: 12px; }
.barree b, .barree .somme { text-decoration: line-through; color: var(--discret); }
.annulee { border: 1px solid var(--trait); border-radius: 10px; padding: 10px 12px; font-size: 14px; color: var(--discret); }
#nom, #inviter { flex: 0 0 auto; }
