/* 📮 Télégramme : l'espace du gérant à la charte du site public (site/site.css, chargé avant).
   Les jetons du socle (fond, panneaux, accent, coins, police) prennent ceux du site, en clair
   seulement comme le site ; les composants du socle utilisés par les vues (carte, bouton, champ,
   pastille, alerte) en prennent l'allure. Rien ici ne touche les autres apps d'Hypatie. */
:root, :root[data-theme="light"], :root[data-theme="dark"] {
  --bg: var(--fond); --panel: var(--blanc); --panel-2: var(--clair); --line: var(--bordure); --text: var(--encre); --muted: var(--doux);
  --telegramme: var(--bleu); --telegramme-soft: var(--bleu-pale); --telegramme-deep: var(--bleu-fonce); --sceau: #8a2b2b;
  --acc: var(--bleu); --acc-soft: var(--bleu-pale); --acc-deep: var(--bleu);
  --late: var(--rouge); --late-soft: var(--rouge-pale); --warn: var(--orange); --warn-soft: var(--orange-pale);
  --ok: var(--vert); --ok-soft: var(--vert-pale); --wait: var(--bleu); --wait-soft: var(--bleu-pale);
  --radius: var(--rayon); --radius-lg: var(--rayon); --pill: 3px;
  --shadow: none; --shadow-float: 0 6px 24px rgba(15, 30, 60, .25);
  --font: var(--police); --font-display: var(--police); --text-size: 16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; /* numéros, identifiants : à chasse fixe ici */
  color-scheme: light;
}
body.admin { font-size: 16px; }
body.admin svg.ico { display: inline-block; vertical-align: -3px; flex: none; }
#app { flex: 1 0 auto; display: flex; flex-direction: column; }
#app > main { flex: 1 0 auto; width: 100%; }

/* En-tête : celui du site, avec quatre onglets sur téléphone */
@media (max-width: 680px) { .nav-admin { grid-template-columns: repeat(4, 1fr) !important; } .nav-admin a { font-size: 14px !important; } }
.pied { margin-top: 48px; }
.lien-bouton { background: none; border: 0; padding: 0; color: var(--bleu); font: inherit; cursor: pointer; }
.lien-bouton:hover { text-decoration: underline; text-underline-offset: 2px; }
.admin-connexion form { display: flex; flex-direction: column; gap: 16px; max-width: 460px; }
.erreur-texte { color: var(--rouge); margin: 0; min-height: 1.2em; }

/* Mise en page des vues : la grille du site */
.page { max-width: 1040px; margin: 0 auto; padding: 32px 20px 24px; display: flex; flex-direction: column; gap: 18px; width: 100%; }
.page > .formulaire-tete { padding: 0 0 4px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1, .page > .row h1, .page > h1 { margin: 0; }
.tg-test { margin-bottom: 14px; }
h1 { font-family: var(--police); font-weight: 700; font-size: clamp(26px, 4vw, 34px); }
h2 { font-family: var(--police); font-size: 22px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--encre); margin: 0 0 .4em; display: block; }
h3 { font-family: var(--police); font-size: 18px; font-weight: 700; color: var(--encre); }
.small { font-size: 14px; } .muted { color: var(--doux); }

/* Composants du socle à l'allure du site */
.card { background: var(--blanc); border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 20px 22px; box-shadow: none; }
.card.flush { padding: 0; }
.btn { height: auto; min-height: 44px; padding: 0 18px; border: 2px solid var(--bleu); border-radius: var(--rayon); background: var(--blanc); color: var(--bleu); font: 600 16px/1.2 var(--police); }
.btn:hover { background: var(--bleu-pale); color: var(--bleu-fonce); }
.btn.primary { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.btn.primary:hover { background: var(--bleu-fonce); border-color: var(--bleu-fonce); filter: none; color: #fff; }
.btn.soft { background: var(--bleu-pale); border-color: var(--bleu-pale); color: var(--bleu); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--bleu); }
.btn.ghost:hover { background: var(--bleu-pale); }
.btn.danger { background: var(--blanc); border-color: var(--rouge); color: var(--rouge); }
.btn.danger:hover { background: var(--rouge-pale); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-width: 1px; }
.btn.full { width: 100%; }
.icon-btn { border-radius: var(--rayon); border-color: var(--bordure-forte); color: var(--bleu); }
.input, select.input, textarea.input { min-height: 46px; border: 1px solid var(--bordure-forte); border-radius: var(--rayon); background: var(--blanc); color: var(--encre); font-size: 16px; }
textarea.input { padding: 10px 12px; }
.input:focus { border-color: var(--bleu); box-shadow: 0 0 0 3px rgba(29, 75, 143, .22); }
label.field { font-size: 15px; font-weight: 600; color: var(--encre); gap: 6px; }
.pill { border-radius: 3px; height: 24px; font-size: 13px; font-weight: 600; background: var(--fond-2); color: var(--doux); }
.chip { border-radius: var(--rayon); }
.alert { border-radius: 0 var(--rayon) var(--rayon) 0; border-left: 4px solid var(--orange); background: var(--orange-pale); color: var(--encre); }
.alert.late { border-left-color: var(--rouge); background: var(--rouge-pale); color: var(--encre); }
.alert.info { border-left-color: var(--bleu); background: var(--bleu-pale); }
.linklike { color: var(--bleu); text-decoration: underline; text-underline-offset: 2px; }
.empty { color: var(--doux); }
.tabs { border-radius: var(--rayon); background: var(--fond-2); }
.tabs > a, .tabs > button, .tabs > span { border-radius: 3px; }
.modal { border-radius: var(--rayon); }
.toast { border-radius: var(--rayon); background: var(--encre); color: #fff; }
.toast button { color: #cfe0ff; }

/* Accueil du gérant */
.tg-avis-lien { text-decoration: none; color: var(--encre); }
.tg-avis-lien:hover b { text-decoration: underline; }
.tg-chiffres { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tg-chiffres .carte { padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.tg-chiffres b { font-size: 30px; line-height: 1.1; color: var(--bleu); }
.tg-chiffres span { font-size: 14px; color: var(--doux); }
.tg-raccourcis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tg-raccourci { display: grid; grid-template-columns: auto 1fr; grid-template-areas: 'i b' 'i s'; gap: 2px 14px; align-items: start; text-decoration: none; color: var(--encre); padding: 20px 22px; border-top: 4px solid var(--bleu); }
.tg-raccourci svg { grid-area: i; color: var(--bleu); margin-top: 2px; }
.tg-raccourci b { grid-area: b; font-size: 19px; color: var(--bleu); }
.tg-raccourci span { grid-area: s; font-size: 15px; color: var(--doux); line-height: 1.45; }
.tg-raccourci:hover { background: var(--clair); }
.tg-raccourci:hover b { text-decoration: underline; }
@media (max-width: 680px) { .tg-chiffres { grid-template-columns: repeat(2, 1fr); } .tg-raccourcis { grid-template-columns: 1fr; } }

/* Liste et fiche */
.tg-l { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tg-l:last-child { border-bottom: 0; } .tg-l:hover { background: var(--panel-2); }
.tg-num { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--acc); flex: none; width: 140px; white-space: nowrap; }
@media (max-width: 680px) { .tg-l { flex-wrap: wrap; } .tg-num { width: 100%; } }
.tg-lt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.tg-cartes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.tg-cartes img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); display: block; }
.tg-actions { gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tg-bloc { display: grid; gap: 8px; padding: 14px 16px; margin-bottom: 10px; }
.tg-bloc h3 { margin: 0; }
.tg-lien { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tg-lien code { flex: 1; min-width: 200px; word-break: break-all; font-size: 12px; padding: 8px 10px; background: var(--panel-2); border-radius: var(--radius); }
.tg-mono { font-family: var(--mono); word-break: break-all; }
.tg-code { font-family: var(--mono); letter-spacing: .2em; font-size: 16px; }
@media (max-width: 600px) { .tg-cartes { grid-template-columns: 1fr; } }

/* J'envoie */
.tg-etape { display: grid; gap: 10px; padding: 16px 18px; margin-bottom: 12px; }
.tg-etape h3 { margin: 0; display: flex; align-items: center; gap: 10px; }
.tg-etape h3 i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--acc); color: #fff; font-size: 13px; font-style: normal; font-weight: 700; flex: none; }
.tg-rec { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tg-rec .btn { min-height: 46px; }
.tg-rec-btn.on { background: var(--sceau); border-color: var(--sceau); }
.tg-chrono { font-family: var(--mono); font-size: 22px; font-weight: 700; min-width: 70px; }
.tg-wave { width: 100%; height: 48px; border-radius: var(--radius); background: var(--panel-2); }
.tg-audio { width: 100%; }
.tg-compte { text-align: right; }
.tg-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tg-dates { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tg-envoi { position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); display: flex; justify-content: flex-end; gap: 8px; padding: 10px 0; background: linear-gradient(transparent, var(--bg) 30%); }
@media (min-width: 721px) { .tg-envoi { bottom: 0; } }
.tg-attente { display: grid; justify-items: center; gap: 10px; padding: 32px; text-align: center; }
.tg-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--acc); animation: tg-tourne .9s linear infinite; }
@keyframes tg-tourne { to { transform: rotate(360deg); } }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.tg-aide { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.tg-err { color: var(--late); }
/* Reçu du prix, façon guichet : lignes pointillées, total en gras. */
.tg-recu { display: grid; gap: 4px; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 13px; }
.tg-recu > div { display: flex; gap: 8px; align-items: baseline; }
.tg-recu > div span { flex: 1; border-bottom: 1px dotted var(--line, #ccc); padding-bottom: 2px; }
.tg-recu > div b { white-space: nowrap; font-weight: 500; }
.tg-recu .tg-recu-total { border-top: 1px solid var(--ink, #222); padding-top: 6px; margin-top: 4px; font-size: 15px; }
.tg-recu .tg-recu-total span { border: 0; font-weight: 600; }
.tg-recu .tg-recu-total b { font-weight: 700; }
.tg-marges { width: 100%; border-collapse: collapse; }
.tg-marges th, .tg-marges td { text-align: right; padding: 3px 6px; border-bottom: 1px solid var(--line, #e5e5e5); }
.tg-marges th:first-child, .tg-marges td:first-child { text-align: left; }

/* ── Guichet « J'envoie » : un écran par étape, prix en bas ───────────────────── */
.tg-guichet { max-width: 640px; margin: 0 auto; }
.tg-guichet h2 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; margin: 6px 0 6px; color: var(--encre); }
.tg-guichet h2 + p { margin: 0 0 14px; }
.tg-progres { display: flex; list-style: none; margin: 4px 0 18px; padding: 0; gap: 0; counter-reset: e; }
.tg-progres li { flex: 1; display: grid; justify-items: center; gap: 4px; position: relative; font-size: 11px; color: var(--muted); }
.tg-progres li::before { content: ''; position: absolute; top: 14px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.tg-progres li:first-child::before { display: none; }
.tg-progres li.fait::before, .tg-progres li.ici::before { background: var(--acc); }
.tg-progres button { position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: var(--panel); color: var(--muted); font: 600 12px/1 var(--mono, monospace); padding: 0; }
.tg-progres li.fait button { background: var(--acc); border-color: var(--acc); color: #fff; cursor: pointer; }
.tg-progres li.ici button { border-color: var(--acc); color: var(--acc); box-shadow: 0 0 0 4px var(--acc-soft); }
.tg-progres li.ici span { color: var(--acc); font-weight: 600; }
@media (max-width: 520px) { .tg-progres span { display: none; } .tg-progres li.ici span { display: block; position: absolute; top: 32px; white-space: nowrap; } .tg-progres { margin-bottom: 30px; } }

.tg-formats { display: grid; gap: 12px; }
.tg-format { display: grid; grid-template-columns: 54px 1fr; grid-template-areas: 'p b' 'p s' 'p e'; gap: 4px 14px; align-items: start; text-align: left; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); color: inherit; font: inherit; cursor: pointer; transition: border-color .15s, transform .15s; }
.tg-format:hover { border-color: var(--acc); transform: translateY(-1px); }
.tg-format.on { border-color: var(--acc); background: var(--acc-soft); }
.tg-format .tg-picto { grid-area: p; line-height: 1; color: var(--bleu); }
.tg-format b { grid-area: b; font-size: 18px; color: var(--acc-deep, var(--acc)); }
.tg-format span:not(.tg-picto) { grid-area: s; font-size: 14px; line-height: 1.45; color: var(--muted); }
.tg-format em { grid-area: e; font-style: normal; font-weight: 700; color: var(--acc); margin-top: 4px; }
.tg-format em small { font-weight: 400; color: var(--muted); }

.tg-occasions { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tg-occ { display: grid; justify-items: center; gap: 8px; padding: 14px 10px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); color: inherit; font: inherit; cursor: pointer; }
.tg-occ img { width: 70px; height: 84px; object-fit: contain; }
.tg-occ.on, .tg-occ:hover { border-color: var(--acc); }
.tg-occ.on { background: var(--acc-soft); }

.tg-micro { display: grid; justify-items: center; gap: 8px; padding: 24px 16px; margin-bottom: 14px; text-align: center; }
.tg-micro-btn { width: 96px; height: 96px; border-radius: 50%; border: 0; background: var(--sceau); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 8px 24px rgba(138, 43, 43, .35); transition: transform .15s; }
.tg-micro-btn:active { transform: scale(.96); }
.tg-micro-btn.on { animation: tg-pouls 1.4s ease-in-out infinite; }
@keyframes tg-pouls { 0%, 100% { box-shadow: 0 0 0 0 rgba(138, 43, 43, .45); } 50% { box-shadow: 0 0 0 18px rgba(138, 43, 43, 0); } }
.tg-micro .tg-chrono { font: 700 34px/1 var(--mono, monospace); color: var(--acc-deep, var(--acc)); }
.tg-micro .tg-audio { width: 100%; max-width: 420px; }

.tg-ban-champ { position: relative; display: grid; gap: 4px; }
.tg-ban { display: grid; position: absolute; top: 100%; left: 0; right: 0; z-index: 5; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tg-ban:empty { display: none; }
.tg-ban button { text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; cursor: pointer; }
.tg-ban button:hover { background: var(--panel-2); }

.tg-opts { display: grid; gap: 10px; }
.tg-opt { display: grid; gap: 6px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.tg-opt.on { border-color: var(--acc); background: var(--acc-soft); }
.tg-opt.bloque { cursor: default; }
.tg-opt.bloque:not(.on) { opacity: .6; }
.tg-opt-tete { display: flex; align-items: center; gap: 10px; }
.tg-opt-tete b { flex: 1; font-size: 16px; }
.tg-opt-tete em { font-style: normal; font-weight: 700; color: var(--acc); white-space: nowrap; }
.tg-coche { width: 22px; height: 22px; border-radius: 3px; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; color: #fff; flex: none; }
.tg-opt.on .tg-coche { background: var(--acc); border-color: var(--acc); }
.tg-opt .tg-dates { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.tg-recap { display: grid; padding: 4px 16px; margin-bottom: 12px; }
.tg-recap-l { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tg-recap-l:last-child { border-bottom: 0; }
.tg-recap-l span { color: var(--muted); font-size: 13px; }
.tg-recap-l b { font-weight: 500; overflow-wrap: anywhere; }

.tg-barre { position: sticky; bottom: 0; z-index: 20; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin: 18px -16px 0; padding: 12px 16px; background: var(--panel); border-top: 1px solid var(--line); border-radius: 0; box-shadow: 0 -6px 20px rgba(0, 0, 0, .06); }
.tg-barre-prix { display: grid; justify-items: end; line-height: 1.1; }
.tg-barre-prix b { font: 700 22px/1 var(--mono, monospace); color: var(--acc-deep, var(--acc)); }
.tg-barre .btn.primary { padding-inline: 22px; }
.tg-pj, .tg-annu { display: grid; gap: 8px; padding: 12px 14px; margin-top: 12px; }
.tg-pj-l { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.tg-pj-l span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-pj-l em { font-style: normal; font-size: 12px; color: var(--muted); }
/* Aperçu des SMS et du lecteur dans la fiche */
.tg-sms { display: grid; gap: 4px; }
.tg-bulle { background: var(--panel-2, #eef1f4); border-radius: 16px 16px 16px 4px; padding: 10px 12px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 340px; }
.tg-bulle b { display: block; font-size: 11px; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.tg-tel { width: 100%; max-width: 390px; height: 700px; border: 10px solid #14212b; border-radius: 34px; overflow: hidden; background: #dfe7ec; justify-self: center; }
.tg-tel iframe { width: 100%; height: 100%; border: 0; display: block; }
.tg-essai { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line, #e5e5e5); }
