/* Carte de visite : page ouverte par le QR code, page de réglages et page d'accueil neutre. Sombre, sobre, un filet doré. */
:root {
  --fond: #0d0d0e;
  --surface: #161618;
  --surface2: #1f1f22;
  --bord: #2c2c30;
  --texte: #f4efe6;
  --doux: #a39d93;
  --discret: #5f5b55;
  --or: #c8a96a;
  --rouge: #e48a7b;
  --vert: #8fcfa6;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--fond); color: var(--texte); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }

/* ---------- Page d'une carte ---------- */
.carte-page {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(52px + env(safe-area-inset-top)) 20px calc(36px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
.avec-barre .carte-page { padding-bottom: calc(132px + env(safe-area-inset-bottom)); }
.identite { text-align: center; }
.mono {
  width: 74px;
  height: 74px;
  margin: 0 auto 22px;
  border-radius: 50%;
  border: 1px solid var(--or);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: 0.08em;
  color: var(--or);
}
.identite h1 { font-family: var(--serif); font-weight: 400; font-size: 31px; line-height: 1.15; margin: 0; letter-spacing: 0.01em; }
.filet { width: 34px; height: 1px; background: var(--or); margin: 16px auto 14px; }
.phrase { color: var(--doux); font-size: 15px; margin: 0 auto; max-width: 320px; }
.boutons { margin-top: 18px; }
.bouton {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  margin-top: 10px;
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--bord);
  color: var(--texte);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.bouton:active { background: var(--surface2); border-color: #3a3a3f; }
.bouton .ico { flex: none; width: 38px; height: 38px; border-radius: 10px; background: var(--surface2); display: grid; place-items: center; color: var(--or); }
.bouton svg { width: 20px; height: 20px; }
.bouton .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bouton .t { font-size: 16px; }
.bouton .d { font-size: 13px; color: var(--doux); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bouton .chev { flex: none; width: 16px; height: 16px; color: var(--discret); }
.bouton.principal { justify-content: center; margin-top: 26px; background: var(--texte); border-color: var(--texte); color: #121212; font-weight: 600; }
.bouton.principal svg { width: 20px; height: 20px; }
.bouton.principal:active { background: #e2dccf; }
.bouton.inactif { opacity: 0.55; pointer-events: none; }
.message { margin: auto 0; text-align: center; color: var(--doux); font-size: 15px; }
.message::before { content: ""; display: block; width: 34px; height: 1px; background: var(--or); margin: 0 auto 18px; }

/* Barre visible seulement sur ton téléphone autorisé */
.barre {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 440px;
  margin: 0 auto;
  padding: 12px;
  border-radius: 16px;
  background: rgba(30, 30, 33, 0.96);
  border: 1px solid var(--or);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  font-size: 14px;
}
.barre .ligne { display: flex; align-items: center; gap: 10px; }
.barre .ligne + .ligne { margin-top: 10px; }
.barre .titre { flex: 1; min-width: 0; color: var(--or); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre a { color: var(--doux); text-decoration: none; }
.barre select { flex: 1; }
.barre .etat-barre { min-width: 18px; color: var(--vert); }

/* ---------- Champs communs ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--bord);
  background: #111113;
  color: var(--texte);
  font-size: 16px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--or); }
button, .bouton-lien {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid var(--texte);
  background: var(--texte);
  color: #121212;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
}
button.secondaire, .bouton-lien.secondaire { background: transparent; color: var(--texte); border-color: var(--bord); font-weight: 500; }
button:disabled { opacity: 0.5; cursor: default; }
:focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }

/* ---------- Réglages ---------- */
.page-admin { padding-bottom: env(safe-area-inset-bottom); }
.entete {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 18px 12px;
  background: rgba(13, 13, 14, 0.94);
  border-bottom: 1px solid var(--bord);
}
.entete h1 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 22px; }
.etat { font-size: 13px; color: var(--doux); text-align: right; }
.etat.ok { color: var(--vert); }
.etat.erreur { color: var(--rouge); }
.admin { max-width: 640px; margin: 0 auto; padding: 8px 14px 40px; }
.bloc { margin-top: 16px; padding: 18px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--bord); }
.bloc h2 { margin: 0 0 4px; font-family: var(--serif); font-weight: 400; font-size: 21px; }
.aide { margin: 0 0 14px; color: var(--doux); font-size: 14px; }
.champ { display: block; margin-top: 12px; }
.champ > span { display: block; margin-bottom: 6px; font-size: 13px; color: var(--doux); }
.aide-champ { display: block; min-height: 0; margin-top: 4px; font-size: 12.5px; color: var(--rouge); }
.aide-champ:empty { display: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions > * { flex: 1 1 140px; }

.cartes { list-style: none; margin: 14px 0 0; padding: 0; }
.ligne-carte {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  grid-template-areas: "num profil voir" "num note note";
  gap: 8px 10px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--bord);
}
.ligne-carte .num { grid-area: num; align-self: start; padding-top: 10px; font-family: var(--serif); color: var(--or); font-size: 17px; }
.ligne-carte .profil { grid-area: profil; }
.ligne-carte .note { grid-area: note; padding: 8px 12px; font-size: 15px; }
.ligne-carte .voir { grid-area: voir; color: var(--doux); font-size: 14px; text-decoration: none; padding: 8px 4px; }
.ligne-carte.coupee .profil { color: var(--rouge); }

.lien { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 0; border-top: 1px solid var(--bord); }
.lien .lien-url { grid-column: 1; }
.lien .retirer { grid-row: 1 / span 2; grid-column: 2; align-self: center; padding: 10px 12px; background: transparent; color: var(--doux); border-color: var(--bord); font-weight: 400; }
.lien .retirer.sur { color: var(--rouge); border-color: var(--rouge); }
.lien .aide-champ { grid-column: 1 / -1; margin-top: -2px; }
#ajouter-lien, #ajouter-mode { margin-top: 12px; width: 100%; }

.mode { padding: 14px; margin-top: 12px; border-radius: 14px; background: #121214; border: 1px solid var(--bord); }
.mode-tete { display: flex; gap: 10px; align-items: center; }
.mode-tete .mode-nom { font-family: var(--serif); font-size: 18px; }
.mode-tete .apercu { flex: none; color: var(--or); font-size: 14px; text-decoration: none; padding: 8px 2px; }
.mode .mode-phrase { margin-top: 10px; font-size: 15px; }
.mode .badge { display: inline-block; margin-top: 10px; font-size: 12px; color: var(--or); letter-spacing: 0.04em; }
.puces { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.puce { position: relative; }
.puce input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.puce span {
  display: inline-block;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--bord);
  color: var(--doux);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.puce input:checked + span { background: var(--or); border-color: var(--or); color: #151208; }
.puce input:focus-visible + span { outline: 2px solid var(--or); outline-offset: 2px; }
.mode .supprimer { margin-top: 12px; padding: 8px 12px; background: transparent; border-color: transparent; color: var(--discret); font-weight: 400; font-size: 14px; }
.mode .supprimer.sur { color: var(--rouge); border-color: var(--rouge); }
.discret { background: transparent; border-color: transparent; text-align: center; }
.lien-danger { background: transparent; border-color: transparent; color: var(--discret); font-weight: 400; font-size: 14px; }
.lien-danger.sur { color: var(--rouge); border-color: var(--rouge); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: 12px;
  background: #26262a;
  border: 1px solid var(--or);
  color: var(--texte);
  font-size: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  z-index: 10;
}

/* ---------- Accueil neutre ---------- */
.neutre { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; }
.neutre .filet { width: 40px; }
