/* La carte d'accueil au téléphone, disposée comme la maquette mobile validée par Henri le 12/10/2026
   (src/carte-telephone.js). Chargée en DERNIER (scripts/modules.json) : elle passe après instrument.css et
   carte-compacte.css. Jetons --i-* seulement, aucune couleur nouvelle (scripts/palette.mjs) ; la rampe des prix
   vient des agrégats (lie-de-vin). Cibles tactiles de 44 px. Au bureau (≥ 900 px), tout ceci est masqué. */

.ct-barre, .ct-resume, .ct-menu { display: none; }
.ct-lib { display: none; }

@media (max-width: 899px) {
  /* ── 1. La barre sous la recherche : sélecteur, Calques, ••• ── */
  html[data-theme] .page-app .ct-barre { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
  html[data-theme] .page-app .ct-barre > :is(.ct-choix, .commande) { height: 40px; min-height: 40px; border: 0; border-radius: var(--r-moyen); background: var(--i-verre); -webkit-backdrop-filter: var(--i-flou); backdrop-filter: var(--i-flou);
    box-shadow: var(--i-filet); color: var(--i-encre); font: inherit; font-size: var(--t-13); cursor: pointer; }
  html[data-theme] .page-app .ct-barre .ct-choix { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; padding: 0 12px; text-align: left; }
  html[data-theme] .page-app .ct-choix > svg { flex: none; width: 15px; height: 15px; color: var(--i-encre-2); }
  html[data-theme] .page-app .ct-choix-type { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500; }
  html[data-theme] .page-app .ct-choix-periode { flex: none; color: var(--i-lib); font-variant-numeric: tabular-nums; }
  /* Calques : icône et mot ; ••• : un carré. Les infobulles de la colonne (instrument.css) n'ont rien à faire ici */
  html[data-theme] .page-app .ct-barre > .commande { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: auto; min-width: 44px; padding: 0 12px; }
  html[data-theme] .page-app .ct-barre > .commande::before { display: none; }
  html[data-theme] .page-app .ct-barre > .commande > svg { width: 16px; height: 16px; color: var(--i-encre-2); }
  html[data-theme] .page-app .ct-barre > .commande[data-commandes-plus] { width: 44px; padding: 0; }
  html[data-theme] .page-app .ct-barre > .commande[data-commandes-plus] > svg { width: 18px; height: 18px; color: var(--i-encre); }
  html[data-theme] .page-app .ct-barre > .commande[aria-pressed="true"], html[data-theme] .page-app .ct-barre > .commande[aria-expanded="true"],
  html[data-theme] .page-app .ct-barre > .ct-choix[aria-expanded="true"] { background: var(--i-panneau); box-shadow: var(--i-filet), var(--i-ombre); }
  html[data-theme] .page-app .ct-barre .ct-lib { display: inline; font-weight: 500; }
  html[data-theme] .page-app .ct-barre > :is(.ct-choix, .commande):focus-visible { outline: 2px solid var(--i-anneau); outline-offset: 1px; }
  /* la colonne de droite n'a plus rien : Calques et ••• sont dans la barre, le reste dans le menu */
  html[data-theme] .page-app .commandes { display: none; }
  /* feuille levée : la barre s'efface, comme la colonne le faisait (instrument.css) */
  html[data-theme] .page-app .ct-barre { transition: opacity 0.2s; }
  html[data-theme] .page-app:has(.feuille:is([data-cran="mi"], [data-cran="haut"])) .ct-barre { opacity: 0; pointer-events: none; }
  /* l'outil de mesure se posait sous la recherche, à gauche de la colonne : il passe sous la barre, pleine largeur */
  html[data-theme] .page-app .outil-mesure { top: calc(env(safe-area-inset-top) + 112px); right: 12px; }

  /* le menu « ••• » : une coche pour l'outil en cours (Mesurer) */
  html[data-theme] .page-app .commandes-tiroir { min-width: 232px; max-height: calc(100svh - 140px); overflow-y: auto; }
  html[data-theme] .page-app .commandes-tiroir > .commande[aria-pressed="true"] { background: var(--i-seg-actif); }
  html[data-theme] .page-app .commandes-tiroir > .commande[aria-pressed="true"]::after { font-weight: 600; }

  /* le menu du sélecteur : type de bien, période des prix, lien vers les filtres complets */
  html[data-theme] .page-app .ct-menu { display: block; position: fixed; z-index: 45; left: 12px; right: 12px; padding: 6px 12px 8px; border-radius: var(--r-carte); background: var(--i-panneau); box-shadow: var(--i-filet), var(--i-ombre);
    color: var(--i-encre); font-size: var(--t-14); animation: surgir 0.14s ease-out; }
  html[data-theme] .page-app .ct-menu[hidden] { display: none; }
  html[data-theme] .page-app .ct-menu-titre { margin: 10px 0 6px; color: var(--i-lib); font-size: var(--t-12); font-weight: 500; }
  html[data-theme] .page-app .ct-puces { display: flex; flex-wrap: wrap; gap: 6px; }
  html[data-theme] .page-app .ct-puce { min-height: 36px; padding: 0 12px; border: 0; border-radius: 18px; background: var(--i-seg); color: var(--i-encre); font: inherit; font-size: var(--t-13); cursor: pointer; position: relative; }
  html[data-theme] .page-app .ct-puce::after { content: ""; position: absolute; inset: -4px 0; } /* 44 px d'appui */
  html[data-theme] .page-app .ct-puce[aria-pressed="true"] { background: var(--i-plein); color: var(--i-sur-plein); font-weight: 500; }
  html[data-theme] .page-app .ct-menu-note { margin: 10px 0 4px; color: var(--i-lib); font-size: var(--t-12); line-height: 1.4; }
  html[data-theme] .page-app .ct-menu-lien { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 44px; margin-top: 6px; padding: 6px 0 2px; border: 0; border-top: 1px solid var(--i-trait);
    background: none; color: var(--i-encre); font: inherit; font-size: var(--t-14); font-weight: 500; text-align: left; cursor: pointer; }
  html[data-theme] .page-app .ct-menu-lien small { color: var(--i-lib); font-size: var(--t-12); font-weight: 400; }

  /* ── 2. Le grand chiffre en tête de la feuille (la feuille basse montre 156 px : poignée, chiffre, échelle) ── */
  html[data-theme] .page-app .ct-resume { display: block; margin: 8px 0 0; }
  html[data-theme] .page-app .ct-resume-haut { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  html[data-theme] .page-app .ct-chiffre { min-width: 0; }
  html[data-theme] .page-app .feuille-corps .ct-lieu { margin: 0; color: var(--i-encre-2); font-size: var(--t-13); font-weight: 500; line-height: 1.3; }
  html[data-theme] .page-app .feuille-corps .ct-prix { margin: 0; color: var(--i-encre); font-size: 1.875rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
  html[data-theme] .page-app .feuille-corps .ct-unite { color: var(--i-lib); font-size: var(--t-15); font-weight: 400; letter-spacing: 0; }
  html[data-theme] .page-app .feuille-corps .ct-quoi { margin: 2px 0 0; color: var(--i-lib); font-size: var(--t-11); line-height: 1.3; }
  html[data-theme] .page-app .feuille-corps .ct-voir { flex: none; min-height: 44px; padding: 0 16px; border: 0; border-radius: var(--r-moyen); background: var(--i-plein); color: var(--i-sur-plein); font: inherit; font-size: var(--t-13); font-weight: 600; cursor: pointer; }
  html[data-theme] .page-app .feuille-corps .ct-voir[aria-expanded="true"] { background: var(--i-seg-actif); color: var(--i-encre); }
  html[data-theme] .page-app .ct-rampe { display: grid; grid-template-columns: minmax(0, 1fr) 118px; align-items: center; gap: 10px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--i-trait); }
  html[data-theme] .page-app .ct-rampe[hidden] { display: none; }
  html[data-theme] .page-app .ct-rampe-titre { overflow: hidden; color: var(--i-lib); font-size: var(--t-11); white-space: nowrap; text-overflow: ellipsis; }
  html[data-theme] .page-app .ct-rampe-droite { display: grid; gap: 3px; }
  html[data-theme] .page-app .ct-rampe-barre { display: flex; height: 5px; overflow: hidden; border-radius: var(--r-fin); }
  html[data-theme] .page-app .ct-rampe-barre i { flex: 1; }
  html[data-theme] .page-app .ct-rampe-bornes { display: flex; justify-content: space-between; color: var(--i-lib); font-size: var(--t-10); font-variant-numeric: tabular-nums; }
  /* le titre d'avant suit le chiffre, un filet les sépare */
  html[data-theme] .page-app .ct-resume + .feuille-titre { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--i-trait); }

  /* ── 3. Calques : une feuille plein écran (cases, opacité, rang, légende, « Voir la carte ») ── */
  html[data-theme] .page-app .legende-carte.cc-en-ligne.ct-plein { top: calc(env(safe-area-inset-top) + 8px); bottom: auto; left: 0; right: 0; height: calc(100svh - env(safe-area-inset-top) - 8px); max-height: none;
    padding: 0 16px; border-radius: 16px 16px 0 0; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--i-panneau); box-shadow: var(--i-filet), 0 0 0 100vmax rgba(0, 0, 0, 0.4); }
  html[data-theme] .page-app .ct-cal-tete { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; margin: 0 -16px; padding: 12px 8px 8px 16px; background: var(--i-panneau); }
  html[data-theme] .page-app .ct-cal-tete h2 { margin: 0; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.015em; }
  html[data-theme] .page-app .ct-cal-compte { flex: 1; color: var(--i-lib); font-size: var(--t-12); }
  html[data-theme] .page-app .ct-x { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--i-seg); color: var(--i-encre); cursor: pointer; }
  html[data-theme] .page-app .ct-x svg { width: 16px; height: 16px; }
  html[data-theme] .page-app .ct-cal-intro { margin: 0 0 4px; color: var(--i-lib); font-size: var(--t-12); line-height: 1.45; }
  html[data-theme] .page-app .ct-groupe { margin: 16px 0 2px; color: var(--i-lib); font-size: var(--t-12); font-weight: 500; }
  html[data-theme] .page-app .ct-liste { margin: 0; padding: 0; list-style: none; }
  html[data-theme] .page-app .ct-couche { border-bottom: 1px solid var(--i-trait); }
  html[data-theme] .page-app .ct-ligne { display: flex; align-items: center; min-height: 52px; }
  html[data-theme] .page-app .ct-case { flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin-left: -10px; padding: 0; border: 0; background: none; color: var(--i-sur-plein); cursor: pointer; }
  html[data-theme] .page-app .ct-case svg { width: 20px; height: 20px; padding: 2px; border-radius: var(--r-pastille); box-shadow: inset 0 0 0 1.5px var(--i-piste); color: transparent; box-sizing: border-box; }
  html[data-theme] .page-app .ct-case[aria-checked="true"] svg { background: var(--i-plein); box-shadow: none; color: var(--i-sur-plein); }
  html[data-theme] .page-app .ct-nom { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px 0; border: 0; background: none; color: var(--i-encre); font: inherit; font-size: var(--t-14); text-align: left; cursor: pointer; }
  html[data-theme] .page-app .ct-nom > span { flex: 1; min-width: 0; }
  html[data-theme] .page-app .ct-nom small { display: block; margin-top: 2px; color: var(--i-lib); font-size: var(--t-11); line-height: 1.3; }
  html[data-theme] .page-app .ct-nom > svg { flex: none; width: 12px; height: 12px; color: var(--i-lib); transition: transform 0.15s; }
  html[data-theme] .page-app .ct-ouverte .ct-nom > svg { transform: rotate(180deg); }
  html[data-theme] .page-app .ct-detail { display: none; padding: 0 0 14px 34px; }
  html[data-theme] .page-app .ct-ouverte .ct-detail { display: block; }
  html[data-theme] .page-app .ct-detail .cc-opacite { grid-template-columns: auto minmax(0, 1fr) 44px; gap: 12px; padding: 0; min-height: 44px; }
  html[data-theme] .page-app .ct-detail .cc-lib-op { display: inline; color: var(--i-lib); font-size: var(--t-12); }
  html[data-theme] .page-app .ct-detail .cc-leg-carte { padding: 4px 0 0; }
  html[data-theme] .page-app .ct-rang { display: flex; align-items: center; gap: 6px; margin: 2px 0 4px; color: var(--i-lib); font-size: var(--t-12); }
  html[data-theme] .page-app .ct-rang > span { flex: 1; }
  html[data-theme] .page-app .ct-bouton { min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-moyen); background: var(--i-seg); color: var(--i-encre); font: inherit; font-size: var(--t-12); cursor: pointer; position: relative; }
  html[data-theme] .page-app .ct-bouton::after { content: ""; position: absolute; inset: -4px 0; }
  html[data-theme] .page-app .ct-bouton:disabled { opacity: 0.4; cursor: default; }
  html[data-theme] .page-app .ct-cal-note { margin: 0 0 4px; color: var(--i-lib); font-size: var(--t-12); }
  html[data-theme] .page-app .ct-cal-pied { position: sticky; bottom: 0; z-index: 2; margin: 16px -16px 0; padding: 10px 16px calc(env(safe-area-inset-bottom) + 12px); background: var(--i-panneau); box-shadow: 0 -1px 0 var(--i-trait); }
  html[data-theme] .page-app .ct-voir-carte { width: 100%; min-height: 46px; border: 0; border-radius: var(--r-carte); background: var(--i-plein); color: var(--i-sur-plein); font: inherit; font-size: var(--t-14); font-weight: 600; cursor: pointer; }
  html[data-theme] .page-app :is(.ct-case, .ct-nom, .ct-x, .ct-voir-carte, .ct-bouton, .ct-puce, .ct-menu-lien, .ct-voir):focus-visible { outline: 2px solid var(--i-anneau); outline-offset: -2px; }
}
@media (max-width: 899px) and (prefers-reduced-motion: reduce) {
  html[data-theme] .page-app :is(.ct-barre, .ct-nom > svg) { transition: none; }
  html[data-theme] .page-app .ct-menu { animation: none; }
}
