/* Arnaya : interface inspirée de l'appli Maison d'Apple (listes groupées,
   commande ronde, contrôles natifs). Police du système, aucun fichier externe. */

:root {
  --fond: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #e9e9ef;
  --encre: #1c1c1e;
  --encre-2: #5f5f66;
  --encre-3: #8a8a91;
  --filet: rgb(60 60 67 / 16%);
  --accent: #1f8a5b;
  --accent-texte: #ffffff;
  --accent-teinte: rgb(31 138 91 / 12%);
  --accent-encre: #17734b;
  --ambre: #ff9f0a;
  --ambre-texte: #2b1a00;
  --danger: #d7372f;
  --ok: #1f8a5b;
  --focus: #0a6cff;
  --ombre-douce: 0 1px 2px rgb(0 0 0 / 5%);
  --ombre-commande: 0 10px 30px -8px rgb(20 40 30 / 28%), 0 2px 6px rgb(0 0 0 / 6%);
  --rayon: 14px;
  --rayon-petit: 10px;
  --courbe: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --encre: #f2f2f7;
    --encre-2: #aeaeb5;
    --encre-3: #8d8d94;
    --filet: rgb(84 84 88 / 55%);
    --accent: #34c77b;
    --accent-texte: #04210f;
    --accent-teinte: rgb(52 199 123 / 16%);
    --accent-encre: #4cd68e;
    --ambre: #ffb340;
    --ambre-texte: #2b1a00;
    --danger: #ff6b61;
    --ok: #4cd68e;
    --focus: #5ea2ff;
    --ombre-douce: none;
    --ombre-commande: 0 10px 34px -8px rgb(0 0 0 / 70%), 0 0 0 1px rgb(255 255 255 / 6%);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --fond: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --encre: #f2f2f7;
  --encre-2: #aeaeb5;
  --encre-3: #8d8d94;
  --filet: rgb(84 84 88 / 55%);
  --accent: #34c77b;
  --accent-texte: #04210f;
  --accent-teinte: rgb(52 199 123 / 16%);
  --accent-encre: #4cd68e;
  --ambre: #ffb340;
  --ambre-texte: #2b1a00;
  --danger: #ff6b61;
  --ok: #4cd68e;
  --focus: #5ea2ff;
  --ombre-douce: none;
  --ombre-commande: 0 10px 34px -8px rgb(0 0 0 / 70%), 0 0 0 1px rgb(255 255 255 / 6%);
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--encre-3) transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fond);
  color: var(--encre);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 17px;
  line-height: 1.42;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--accent);
  font-variant-numeric: tabular-nums;
}

::selection { background: var(--accent-teinte); color: var(--encre); }

[hidden] { display: none !important; }

button { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 8px;
}

.page {
  max-width: 30rem;
  margin: 0 auto;
  padding:
    max(12px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(40px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

.page:has(.vue-large:not([hidden])) { max-width: 40rem; }

/* Barre du haut */

.barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  margin-bottom: 12px;
}

.marque {
  display: flex;
  align-items: center;
  gap: 10px;
}

.marque-tuile {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-texte);
}

.marque-tuile svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.marque-nom {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

/* Contrôle segmenté (langue, durée d'accès) */

.segmente {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: none;
  margin: 0;
  border-radius: 9px;
  background: var(--surface-2);
}

.segmente-petit .langue {
  min-width: 46px;
  min-height: 32px;
  padding: 4px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--encre-2);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 200ms var(--courbe), color 200ms var(--courbe);
}

.segmente-petit .langue[aria-pressed="true"] {
  background: var(--surface);
  color: var(--encre);
  box-shadow: 0 1px 3px rgb(0 0 0 / 12%), 0 1px 1px rgb(0 0 0 / 4%);
}

.choix-acces {
  border: none;
  margin: 0 0 16px;
  padding: 0;
  min-width: 0;
}

.choix-acces legend { padding: 0; }

.choix-acces .option {
  position: relative;
  flex: 1 1 0;
  display: grid;
  place-items: center;
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 7px;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--encre-2);
  cursor: pointer;
  transition: background-color 200ms var(--courbe), color 200ms var(--courbe);
}

.choix-acces .option input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.choix-acces .option:has(input:checked) {
  background: var(--surface);
  color: var(--encre);
  font-weight: 600;
  box-shadow: 0 1px 3px rgb(0 0 0 / 12%), 0 1px 1px rgb(0 0 0 / 4%);
}

.choix-acces .option:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

/* Titres et textes */

.grand-titre {
  margin: 4px 0 6px;
  font-size: 2.125rem;
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.intro {
  margin: 0 0 24px;
  color: var(--encre-2);
}

.chargement { color: var(--encre-2); }

.section { margin-top: 32px; }

.titre-section,
.etiquette-section {
  display: block;
  margin: 0 0 8px 16px;
  padding: 0;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--encre-2);
}

.aide {
  margin: 8px 16px 18px;
  font-size: 0.82rem;
  color: var(--encre-2);
}

.message {
  min-height: 1.4em;
  margin: 12px 4px 0;
  font-size: 0.92rem;
}

.message.erreur { color: var(--danger); }
.message.succes { color: var(--ok); }

/* Listes groupées (iOS) */

.groupe {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border-radius: var(--rayon);
  box-shadow: var(--ombre-douce);
  overflow: hidden;
}

.ligne-champ {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 4px 16px;
  position: relative;
}

.ligne-champ + .ligne-champ::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  border-top: 1px solid var(--filet);
}

.ligne-champ > label,
.ligne-champ > span {
  flex: 0 0 auto;
  min-width: 7.5rem;
  font-weight: 400;
}

.ligne-champ input:not([type="checkbox"]) {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: var(--encre);
  font: inherit;
  text-align: right;
}

.ligne-champ input::placeholder { color: var(--encre-3); opacity: 1; }
.ligne-champ input:focus-visible { outline: none; }
.ligne-champ:focus-within { background: var(--accent-teinte); }

.ligne-champ input[type="datetime-local"] { text-align: right; }

.champ-code {
  letter-spacing: 0.22em;
  font-weight: 600;
}

.champ-code::placeholder {
  letter-spacing: normal;
  font-weight: 400;
}

/* Ordinateur : la page renvoie vers le téléphone */

.bloc-ordinateur {
  padding: 28px 22px 10px;
  text-align: center;
  margin-bottom: 24px;
}

.bloc-ordinateur-icone {
  width: 48px;
  height: 48px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bloc-ordinateur h2 {
  margin: 10px 0 6px;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.bloc-ordinateur p {
  margin: 0 auto;
  max-width: 34ch;
  color: var(--encre-2);
  font-size: 0.95rem;
}

.ligne-lien {
  min-height: 44px;
  margin-top: 10px;
  padding: 0 8px;
  border: none;
  background: none;
  color: var(--encre-2);
  font-size: 0.86rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Champ piège anti-robot : hors de l'écran, jamais vu ni atteint au clavier */
.piege {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Saisie du code en 6 cases */

.code-cases {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.code-saisie {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: none;
  font-size: 16px;
  color: transparent;
  caret-color: transparent;
  cursor: text;
}

.case {
  display: grid;
  place-items: center;
  aspect-ratio: 5 / 6;
  max-height: 64px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--ombre-douce), inset 0 0 0 1px var(--filet);
  font-size: 1.6rem;
  font-weight: 600;
  transition: box-shadow 160ms var(--courbe), transform 160ms var(--courbe);
}

.code-cases:focus-within .case.active {
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px var(--accent-teinte);
}

.code-cases:focus-within .case.active::after {
  content: "";
  width: 2px;
  height: 1.4rem;
  border-radius: 1px;
  background: var(--accent);
  animation: clignote 1s steps(1) infinite;
}

.case.pleine { transform: scale(1.02); }

@keyframes clignote { 50% { opacity: 0; } }

/* Boutons */

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--rayon);
  font-weight: 600;
  cursor: pointer;
  transition: transform 140ms var(--courbe), filter 140ms var(--courbe), opacity 140ms;
}

.bouton:active:not(:disabled) { transform: scale(0.98); }
.bouton:disabled { opacity: 0.55; cursor: progress; }

.bouton-principal {
  width: 100%;
  background: var(--accent);
  color: var(--accent-texte);
}

.bouton-principal:hover:not(:disabled) { filter: brightness(1.06); }

.bouton-teinte {
  width: 100%;
  background: var(--accent-teinte);
  color: var(--accent-encre);
}

.bouton-petit {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.86rem;
  width: auto;
}

.bouton-danger {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.rangee {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rangee .bouton { flex: 1 1 auto; }

/* Commande du portail */

.validite {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--ombre-douce);
  color: var(--encre-2);
  font-size: 0.86rem;
}

.portail {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 0 24px;
}

.portail-commande {
  position: relative;
  width: min(76vw, 264px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.anneau {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}

.anneau circle {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}

.anneau-fond { stroke: color-mix(in srgb, var(--filet) 60%, transparent); }

.bouton-portail .compte {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.anneau-progres {
  --progres: 0;
  stroke: var(--accent);
  stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--progres) * 100);
  opacity: 0;
  transition: stroke-dashoffset 1s linear, opacity 300ms var(--courbe);
}

.portail[data-etat="mouvement"] .anneau-progres { opacity: 1; }

.bouton-portail {
  width: 84%;
  aspect-ratio: 1;
  border: none;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18%;
  background: var(--surface);
  color: var(--encre);
  box-shadow: var(--ombre-commande);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 220ms var(--courbe),
    background-color 260ms var(--courbe),
    color 260ms var(--courbe),
    box-shadow 260ms var(--courbe);
}

.bouton-portail svg {
  width: 52px;
  height: 52px;
  flex: none;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 260ms var(--courbe);
}

.bouton-portail:hover:not(:disabled) { transform: translateY(-2px); }
.bouton-portail:active:not(:disabled) { transform: scale(0.95); }
.bouton-portail:focus-visible { border-radius: 50%; outline-offset: 6px; }

.portail[data-etat="confirmer"] .bouton-portail {
  background: var(--ambre);
  color: var(--ambre-texte);
  animation: invite 1.4s var(--courbe) infinite;
}

.portail[data-etat="confirmer"] .bouton-portail svg { stroke: var(--ambre-texte); }

.portail[data-etat="envoi"] .bouton-portail,
.portail[data-etat="mouvement"] .bouton-portail {
  background: var(--accent);
  color: var(--accent-texte);
  cursor: default;
}

.portail[data-etat="envoi"] .bouton-portail svg,
.portail[data-etat="mouvement"] .bouton-portail svg { stroke: var(--accent-texte); }

.portail[data-etat="envoi"] .bouton-portail { transform: scale(0.96); }

.bouton-portail:disabled { cursor: default; }

.portail[data-etat="indisponible"] .bouton-portail {
  background: var(--surface-2);
  color: var(--encre-3);
  box-shadow: none;
}

.portail[data-etat="indisponible"] .bouton-portail svg { stroke: var(--encre-3); }

@keyframes invite {
  0%, 100% { box-shadow: var(--ombre-commande), 0 0 0 0 rgb(255 159 10 / 45%); }
  50% { box-shadow: var(--ombre-commande), 0 0 0 14px rgb(255 159 10 / 0%); }
}

.etat {
  min-height: 2.9em;
  margin: 22px 8px 0;
  text-align: center;
  color: var(--encre-2);
  font-size: 0.95rem;
  text-wrap: balance;
}

.etat.erreur { color: var(--danger); }
.etat.succes { color: var(--ok); }

/* Étapes */

.etapes li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  position: relative;
  font-size: 0.95rem;
}

.etapes li + li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 52px;
  right: 0;
  border-top: 1px solid var(--filet);
}

.etape-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--accent-teinte);
  color: var(--accent-encre);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Lignes-boutons (Administration, déconnexion) */

.liste-actions { margin-top: 20px; }

.ligne-bouton {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border: none;
  background: transparent;
  color: var(--accent-encre);
  text-align: left;
  cursor: pointer;
  position: relative;
}

.ligne-bouton + .ligne-bouton::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  border-top: 1px solid var(--filet);
}

.ligne-bouton:active { background: var(--surface-2); }
.ligne-danger { color: var(--danger); }
.ligne-bouton:focus-visible { outline-offset: -3px; border-radius: var(--rayon); }

.chevron {
  width: 8px;
  height: 14px;
  fill: none;
  stroke: var(--encre-3);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Administration */

.retour {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-left: -6px;
  padding: 0 6px;
  border: none;
  background: none;
  color: var(--accent-encre);
  cursor: pointer;
}

.retour svg {
  width: 10px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.carte-code {
  margin-top: 20px;
  padding: 20px 16px 16px;
  box-shadow: var(--ombre-douce), inset 0 0 0 2px var(--accent);
}

.carte-code .aide { margin: 4px 0 14px; }

.carte-code-titre {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--encre-2);
}

.code-grand {
  margin: 6px 0 0;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

textarea {
  display: block;
  width: 100%;
  min-height: 120px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: none;
  border-radius: var(--rayon-petit);
  background: var(--fond);
  color: var(--encre);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.45;
  resize: vertical;
}

.personne {
  position: relative;
  padding: 12px 16px;
}

.personne + .personne::before {
  content: "";
  position: absolute;
  top: 0;
  left: 68px;
  right: 0;
  border-top: 1px solid var(--filet);
}

.personne-tete {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-teinte);
  color: var(--accent-encre);
  font-weight: 700;
  font-size: 1rem;
}

.avatar.expire { background: var(--surface-2); color: var(--encre-3); }

.personne-texte { flex: 1 1 auto; min-width: 0; }

.personne-nom {
  display: block;
  font-weight: 600;
}

.personne-details {
  display: block;
  margin-top: 1px;
  color: var(--encre-2);
  font-size: 0.82rem;
}

.pastille {
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-teinte);
  color: var(--accent-encre);
  font-size: 0.75rem;
  font-weight: 600;
}

.pastille.expire { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.pastille.a-venir { background: color-mix(in srgb, var(--ambre) 18%, transparent); color: color-mix(in srgb, var(--ambre) 55%, var(--encre)); }
.pastille.admin { background: var(--surface-2); color: var(--encre-2); }

.personne .rangee {
  margin: 10px 0 0 52px;
}

.personne .rangee .bouton { flex: 0 0 auto; }

.groupe + .etiquette-section { margin-top: 22px; }

.edition-dates {
  margin: 12px 0 2px 52px;
  padding: 14px;
  border-radius: var(--rayon-petit);
  background: var(--fond);
}

.edition-dates .groupe { box-shadow: none; }
.edition-dates .aide { margin: 8px 4px 12px; }
.edition-dates .message { margin-top: 8px; }

.personnes .vide,
.journal .vide {
  padding: 14px 16px;
  color: var(--encre-2);
}

/* Interrupteur (iOS) */

.ligne-interrupteur {
  justify-content: space-between;
  cursor: pointer;
}

.interrupteur {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--filet);
  cursor: pointer;
  transition: background-color 220ms var(--courbe);
}

.interrupteur::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 3px 8px rgb(0 0 0 / 15%), 0 1px 1px rgb(0 0 0 / 16%);
  transition: transform 260ms var(--courbe);
}

.interrupteur:checked { background: var(--accent); box-shadow: none; }
.interrupteur:checked::before { transform: translateX(20px); }
.interrupteur:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 999px; }

/* Journal */

.journal li {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  padding: 10px 16px;
  font-size: 0.9rem;
}

.journal li + li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  border-top: 1px solid var(--filet);
}

.journal time { color: var(--encre-2); font-size: 0.78rem; }
.journal .type-appui { color: var(--ok); font-weight: 600; }
.journal .type-refus, .journal .type-echec { color: var(--danger); font-weight: 600; }

/* Formulaires */

.formulaire .bouton-principal,
.formulaire .bouton-teinte { margin-top: 4px; }

/* Apparition des vues */

.vue:not([hidden]) { animation: entree 360ms var(--courbe) both; }

@keyframes entree {
  from { opacity: 0.001; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (min-width: 640px) {
  .grand-titre { font-size: 2.5rem; }
}

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