/* Arpegon, applications : le kit d'interface commun.
   Une seule feuille pour toutes les applications. La couleur de marque se règle par --marque (et --marque-texte).
   Clair et sombre automatiques. Aucune ressource externe : polices servies par /polices/. */

@font-face { font-family: "Inter"; src: url("/polices/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --marque: #4f46e5;
  --marque-texte: #ffffff;
  --marque-douce: color-mix(in oklab, var(--marque) 12%, var(--surface));
  /* Couleur de marque pour du texte : plus claire en mode sombre, pour rester lisible. */
  --marque-vif: var(--marque);
  --fond: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #f2f2f4;
  --texte: #16161d;
  --texte-doux: #5c5c6a;
  --texte-pale: #8a8a97;
  --bord: #e4e4e9;
  --bord-fort: #d2d2da;
  --succes: #15803d; --succes-fond: #e8f6ed;
  --alerte: #b45309; --alerte-fond: #fdf3e2;
  --danger: #c2261d; --danger-fond: #fdecea;
  --info: #1d5fbf; --info-fond: #e8f0fc;
  --rayon: 12px;
  --rayon-petit: 8px;
  /* Mouvement : une seule courbe pour tout, un ressort pour ce qui « arrive ». */
  --courbe: cubic-bezier(.2, .8, .2, 1);
  --courbe-ressort: cubic-bezier(.34, 1.4, .64, 1);
  --anneau: 0 0 0 3px color-mix(in oklab, var(--marque) 28%, transparent);
  --ombre: 0 1px 2px rgb(16 16 24 / .05), 0 1px 1px rgb(16 16 24 / .03);
  --ombre-haute: 0 12px 32px -8px rgb(16 16 24 / .18), 0 2px 6px rgb(16 16 24 / .06);
  --police: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0f0f13; --surface: #17171c; --surface-2: #1f1f26;
    --texte: #ececf1; --texte-doux: #a3a3b2; --texte-pale: #74748a;
    --bord: #2a2a33; --bord-fort: #383844;
    --succes: #4ade80; --succes-fond: #12291b;
    --alerte: #fbbf24; --alerte-fond: #2c2312;
    --danger: #f87171; --danger-fond: #2f1515;
    --info: #7aa7ff; --info-fond: #152238;
    --ombre: 0 1px 2px rgb(0 0 0 / .4);
    --ombre-haute: 0 16px 40px -10px rgb(0 0 0 / .6);
    --marque-douce: color-mix(in oklab, var(--marque) 22%, var(--surface));
    --marque-vif: color-mix(in oklab, var(--marque) 45%, white);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 15px/1.5 var(--police); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: 26px; font-weight: 650; }
h2 { font-size: 19px; font-weight: 620; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
a { color: var(--marque-vif); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--marque); outline-offset: 2px; }
.u-doux { color: var(--texte-doux); }
.u-pale { color: var(--texte-pale); font-size: 13px; }
.u-chiffre { font-variant-numeric: tabular-nums; }
.u-droite { text-align: right; }
.u-pile { display: grid; gap: var(--ecart, 12px); }
.u-ligne { display: flex; align-items: center; gap: var(--ecart, 10px); flex-wrap: wrap; }
.u-entre { justify-content: space-between; }
.u-masque { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Coquille : barre latérale sur ordinateur, barre du bas sur téléphone ---------- */
.ap-coquille { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }
.ap-laterale { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--bord); }
.ap-marque { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; font-weight: 650; font-size: 15px; color: var(--texte); text-decoration: none; }
.ap-marque-logo { width: 30px; height: 30px; border-radius: 8px; background: var(--marque); color: var(--marque-texte); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; overflow: hidden; }
.ap-marque-logo img { width: 100%; height: 100%; object-fit: cover; }
.ap-nav { display: grid; gap: 2px; }
.ap-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--rayon-petit); color: var(--texte-doux); text-decoration: none; font-weight: 500; font-size: 14px; }
.ap-nav a:hover { background: var(--surface-2); color: var(--texte); }
.ap-nav a[aria-current="page"] { background: var(--marque-douce); color: var(--marque-vif); }
.ap-nav svg { width: 18px; height: 18px; flex: none; }
.ap-pied { margin-top: auto; display: grid; gap: 8px; padding: 10px 8px 0; border-top: 1px solid var(--bord); }
.ap-moi { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 13px; }
.ap-moi span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-principal { min-width: 0; padding: 28px clamp(16px, 4vw, 40px) 48px; }
.ap-contenu { max-width: 1120px; margin: 0 auto; display: grid; gap: 22px; }
.ap-contenu > * { min-width: 0; }
.ap-mobile { display: none; }
@media (max-width: 860px) {
  .ap-coquille { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .ap-laterale { display: none; }
  .ap-mobile { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; padding: 10px 16px; background: color-mix(in oklab, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--bord); }
  .ap-bas { position: fixed; inset: auto 0 0 0; z-index: 20; display: flex; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--bord); }
  .ap-bas a { display: grid; justify-items: center; gap: 2px; padding: 4px 10px; font-size: 11px; color: var(--texte-pale); text-decoration: none; }
  .ap-bas a[aria-current="page"] { color: var(--marque-vif); }
  .ap-bas svg { width: 22px; height: 22px; }
  .ap-principal { padding: 20px 16px 96px; }
}
@media (min-width: 861px) { .ap-bas { display: none; } }

/* ---------- En-tête de page ---------- */
.ap-entete { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ap-entete p { color: var(--texte-doux); margin-top: 4px; }
.ap-fil { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--texte-pale); margin-bottom: 6px; }
.ap-fil a { color: var(--texte-doux); text-decoration: none; }
.ap-fil a:hover { color: var(--texte); }

/* ---------- Boutons ---------- */
.ap-bouton { --b-fond: var(--surface); --b-texte: var(--texte); --b-bord: var(--bord-fort); display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--rayon-petit); border: 1px solid var(--b-bord); background: var(--b-fond); color: var(--b-texte); font: inherit; font-size: 14px; font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: var(--ombre); transition: background .15s, border-color .15s, transform .05s; }
.ap-bouton:hover { --b-fond: var(--surface-2); }
.ap-bouton:active { transform: translateY(1px); }
.ap-bouton[disabled] { opacity: .55; cursor: not-allowed; }
.ap-bouton svg { width: 16px; height: 16px; }
.ap-bouton.primaire { --b-fond: var(--marque); --b-texte: var(--marque-texte); --b-bord: transparent; }
.ap-bouton.primaire:hover { --b-fond: color-mix(in oklab, var(--marque) 88%, black); }
.ap-bouton.danger { --b-fond: var(--danger); --b-texte: #fff; --b-bord: transparent; }
.ap-bouton.discret { --b-fond: transparent; --b-bord: transparent; box-shadow: none; }
.ap-bouton.discret:hover { --b-fond: var(--surface-2); }
.ap-bouton.petit { height: 32px; padding: 0 10px; font-size: 13px; }
.ap-bouton.icone { width: 38px; padding: 0; }
.ap-bouton.petit.icone { width: 32px; }
.ap-bouton.large { width: 100%; }
.ap-tourne { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ap-tour .7s linear infinite; }
@keyframes ap-tour { to { transform: rotate(360deg); } }

/* ---------- Cartes, statistiques, badges ---------- */
.ap-carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); }
.ap-carte-corps { padding: 20px; display: grid; gap: 14px; }
.ap-carte-tete { padding: 16px 20px; border-bottom: 1px solid var(--bord); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ap-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, calc(50% - 7px)), 1fr)); gap: 14px; }
@media (max-width: 640px) { .ap-stat { padding: 14px; } .ap-stat-valeur { font-size: 21px; } }
/* Page avec un panneau latéral (récapitulatif, total, suivi) : empilé sur téléphone, panneau en premier. */
.ap-colonnes { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.ap-colonnes > * { display: grid; gap: 16px; min-width: 0; }
@media (max-width: 960px) { .ap-colonnes { grid-template-columns: 1fr; } .ap-colonnes > .ap-panneau { order: -1; } }
.ap-stat { padding: 18px 20px; display: grid; gap: 6px; }
.ap-stat-libelle { font-size: 13px; color: var(--texte-doux); display: flex; align-items: center; gap: 8px; }
.ap-stat-libelle svg { width: 16px; height: 16px; }
.ap-stat-valeur { font-size: 26px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ap-stat-note { font-size: 12.5px; color: var(--texte-pale); }
.ap-badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 550; background: var(--surface-2); color: var(--texte-doux); white-space: nowrap; }
.ap-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ap-badge.succes { background: var(--succes-fond); color: var(--succes); }
.ap-badge.alerte { background: var(--alerte-fond); color: var(--alerte); }
.ap-badge.danger { background: var(--danger-fond); color: var(--danger); }
.ap-badge.info { background: var(--info-fond); color: var(--info); }
.ap-badge.marque { background: var(--marque-douce); color: var(--marque-vif); }
.ap-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--marque-douce); color: var(--marque-vif); display: grid; place-items: center; font-size: 12px; font-weight: 650; flex: none; }

/* ---------- Formulaires ---------- */
.ap-champ { display: grid; gap: 6px; }
.ap-champ > span { font-size: 13.5px; font-weight: 550; }
.ap-champ small { font-size: 12.5px; color: var(--texte-pale); }
.ap-champ small.erreur { color: var(--danger); }
.ap-saisie { width: 100%; height: 38px; padding: 0 12px; border-radius: var(--rayon-petit); border: 1px solid var(--bord-fort); background: var(--surface); color: var(--texte); font: inherit; font-size: 14px; transition: border-color .15s, box-shadow .15s; }
textarea.ap-saisie { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
select.ap-saisie { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a8a97' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.ap-saisie:focus { outline: none; border-color: var(--marque); box-shadow: 0 0 0 3px color-mix(in oklab, var(--marque) 22%, transparent); }
.ap-saisie[aria-invalid="true"] { border-color: var(--danger); }
.ap-coche { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.ap-coche input { width: 18px; height: 18px; accent-color: var(--marque); }
.ap-grille { display: grid; gap: 14px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); align-content: start; }
.ap-ligne-saisie select.ap-saisie { padding-right: 28px; background-position: right 7px center; }
.ap-grille > .plein { grid-column: 1 / -1; }
@media (max-width: 640px) { .ap-grille { grid-template-columns: 1fr; } }
/* Une ligne de champs (un jour et ses heures, une quantité et son unité) : alignés en bas, repliés seuls sur téléphone. */
.ap-ligne { display: grid; gap: 10px 14px; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); align-items: end; padding: 8px 0; border-bottom: 1px solid var(--bord); }
.ap-ligne:last-of-type { border-bottom: 0; }
.ap-ligne > .ap-coche { min-height: 40px; align-self: center; }
.ap-ligne .ap-facultatif { display: none; }
/* Dans un tableau, une ligne sert à grouper des boutons : ni trait ni marge, boutons à leur taille. */
td .ap-ligne, .ap-tableau .ap-ligne { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; padding: 0; border: 0; }
@media (max-width: 520px) { .ap-ligne { grid-template-columns: 1fr 1fr; } .ap-ligne > .ap-coche { grid-column: 1 / -1; min-height: 0; } }
.ap-recherche { position: relative; }
.ap-recherche svg { position: absolute; left: 11px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--texte-pale); }
.ap-recherche .ap-saisie { padding-left: 34px; }

/* ---------- Éditeur de lignes (devis, factures, commandes) ---------- */
.ap-lignes { display: grid; gap: 10px; container-type: inline-size; }
.ap-lignes-tete, .ap-ligne-saisie { display: grid; grid-template-columns: var(--gabarit); gap: 10px; align-items: center; }
.ap-lignes-tete { font-size: 12.5px; font-weight: 550; color: var(--texte-doux); }
.ap-ligne-saisie .ap-champ > span { display: none; }
/* Selon la place de l'éditeur lui-même : une rangée, puis désignation au-dessus des chiffres, puis petites fiches. */
@container (max-width: 720px) {
  .ap-lignes-tete { display: none; }
  .ap-ligne-saisie { grid-template-columns: repeat(var(--chiffres, 4), minmax(0, 1fr)) 38px; padding: 12px; border: 1px solid var(--bord); border-radius: var(--rayon-petit); background: var(--surface-2); }
  .ap-ligne-saisie .ap-champ > span { display: block; font-size: 12.5px; }
  .ap-ligne-saisie > .large { grid-column: 1 / -2; grid-row: 1; }
  .ap-ligne-saisie > .ap-bouton { grid-column: -2; grid-row: 1; align-self: end; }
}
@container (max-width: 440px) {
  .ap-ligne-saisie { grid-template-columns: 1fr 1fr; }
  .ap-ligne-saisie > .large { grid-column: 1 / -1; }
  .ap-ligne-saisie > .ap-bouton { grid-column: 1 / -1; grid-row: auto; justify-self: end; }
}

/* ---------- Tableaux (cartes sur téléphone) ---------- */
.ap-tableau-boite { overflow: hidden; }
.ap-tableau { width: 100%; border-collapse: collapse; font-size: 14px; }
.ap-tableau th { text-align: left; font-size: 12.5px; font-weight: 550; color: var(--texte-doux); padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--bord); white-space: nowrap; }
.ap-tableau td { padding: 12px 16px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
.ap-tableau tr:last-child td { border-bottom: 0; }
.ap-tableau tbody tr.cliquable { cursor: pointer; }
.ap-tableau tbody tr.cliquable:hover { background: var(--surface-2); }
.ap-tableau .num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .ap-tableau, .ap-tableau tbody { display: block; }
  .ap-tableau thead { display: none; }
  .ap-tableau tr { display: grid; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--bord); }
  .ap-tableau td { display: flex; justify-content: space-between; gap: 12px; padding: 0; border: 0; min-width: 0; text-align: right; overflow-wrap: anywhere; }
  .ap-tableau td::before { flex: none; text-align: left; }
  .ap-tableau td::before { content: attr(data-libelle); color: var(--texte-pale); font-size: 12.5px; }
  .ap-tableau .num { text-align: right; }
}

/* ---------- États : vide, chargement, erreur ---------- */
.ap-vide { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 48px 20px; }
.ap-vide-icone { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--marque-douce); color: var(--marque-vif); }
.ap-vide-icone svg { width: 22px; height: 22px; }
.ap-vide p { color: var(--texte-doux); max-width: 420px; }
.ap-squelette { border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in oklab, var(--surface-2) 60%, var(--surface)) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: ap-lueur 1.3s ease-in-out infinite; height: 14px; }
@keyframes ap-lueur { to { background-position: -200% 0; } }
.ap-encart { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--rayon-petit); font-size: 14px; background: var(--info-fond); color: var(--info); }
.ap-encart.danger { background: var(--danger-fond); color: var(--danger); }
.ap-encart.succes { background: var(--succes-fond); color: var(--succes); }
.ap-encart svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

/* ---------- Dialogue, notifications, onglets, menu ---------- */
dialog.ap-dialogue { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--bord); border-radius: 14px; background: var(--surface); color: var(--texte); box-shadow: var(--ombre-haute); }
dialog.ap-dialogue::backdrop { background: rgb(10 10 16 / .45); backdrop-filter: blur(2px); }
dialog.ap-dialogue[open] { animation: ap-entree .16s ease-out; }
@keyframes ap-entree { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.ap-dialogue-tete { padding: 18px 20px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ap-dialogue-corps { padding: 16px 20px; display: grid; gap: 14px; align-content: start; }
.ap-dialogue-pied { padding: 14px 20px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--bord); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.ap-notifs { position: fixed; z-index: 100; right: 16px; bottom: 16px; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
@media (max-width: 860px) { .ap-notifs { bottom: 84px; } }
.ap-notif { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--texte); color: var(--fond); box-shadow: var(--ombre-haute); font-size: 14px; animation: ap-entree .18s ease-out; }
.ap-notif.danger { background: var(--danger); color: #fff; }
.ap-notif svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.ap-onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--bord); overflow-x: auto; }
/* Dans une ligne (onglets et recherche), les onglets défilent au lieu d'élargir la page sur téléphone. */
.u-ligne > .ap-onglets { min-width: 0; max-width: 100%; }
.ap-ecran > * { min-width: 0; }
.ap-onglets button { padding: 9px 12px; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 550; color: var(--texte-doux); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.ap-onglets button[aria-selected="true"] { color: var(--texte); border-bottom-color: var(--marque); }

/* ---------- Écran de connexion ---------- */
.ap-connexion { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, var(--marque-douce), transparent 70%), var(--fond); }
.ap-connexion .ap-carte { width: min(400px, 100%); }
.ap-connexion .ap-carte-corps { padding: 28px; gap: 18px; }
.ap-connexion .ap-marque-logo { width: 42px; height: 42px; border-radius: 11px; font-size: 18px; }

/* ---------- Impression (devis, factures, bons) ---------- */
/* ---------------------------------------------------------------- Briques métier (briques.mjs) */
.ap-section { display: grid; gap: 14px; }
.ap-section h2 { font-size: 17px; }
/* Planning : une ligne par rendez-vous ou commande, en carte sur téléphone. */
.ap-jour { display: grid; gap: 8px; margin-top: 18px; }
.ap-jour > h2 { font-size: 15px; font-weight: 620; color: var(--texte-doux); display: flex; align-items: center; gap: 8px; }
.ap-jour > h2 svg { width: 16px; height: 16px; }
.ap-jour-urgent { padding: 14px; border-radius: var(--rayon); background: var(--alerte-fond); }
.ap-jour-urgent > h2 { color: var(--alerte); text-transform: none; }
.ap-jour-vide { display: flex; gap: 12px; align-items: baseline; margin-top: 10px; }
.ap-jour-vide > h2 { font-size: 14px; }
.ap-creneau-date { font-size: 12.5px; font-weight: 600; color: var(--texte-doux); margin-top: 4px; }
.ap-creneau { display: grid; grid-template-columns: 76px minmax(0, 1.3fr) minmax(0, 1.2fr) auto auto; gap: 14px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); transition: border-color .15s var(--courbe), opacity .2s; }
.ap-creneau:hover { border-color: var(--bord-fort); }
.ap-creneau.annule { opacity: .55; }
.ap-creneau.annule .ap-creneau-qui strong { text-decoration: line-through; }
.ap-creneau-heure { display: grid; font-variant-numeric: tabular-nums; }
.ap-creneau-heure strong { font-size: 17px; }
.ap-creneau-heure small, .ap-creneau-qui small, .ap-creneau-quoi small { font-size: 12.5px; }
.ap-creneau-qui, .ap-creneau-quoi { display: grid; gap: 2px; min-width: 0; }
.ap-creneau-note { color: var(--texte-doux); font-style: italic; }
.ap-creneau-actions { display: flex; gap: 4px; align-items: center; justify-content: flex-end; }
@media (max-width: 720px) {
  .ap-creneau { grid-template-columns: 60px minmax(0, 1fr) auto; grid-template-areas: "h q b" "h o o" "a a a"; gap: 6px 12px; }
  .ap-creneau-heure { grid-area: h; } .ap-creneau-qui { grid-area: q; } .ap-creneau-quoi { grid-area: o; } .ap-creneau > .ap-badge { grid-area: b; align-self: start; } .ap-creneau-actions { grid-area: a; justify-content: space-between; border-top: 1px solid var(--bord); padding-top: 8px; margin-top: 2px; }
}
.ap-recap h2 { font-size: 15px; }
.ap-recap-liste { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-recap-liste span { padding: 6px 12px; border-radius: 999px; background: var(--marque-douce); font-size: 14px; }
.ap-recap-liste b { font-variant-numeric: tabular-nums; margin-right: 2px; }
.ap-puce { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13.5px; }
button.ap-puce { border: 0; font: inherit; color: inherit; cursor: pointer; padding: 6px 12px; transition: background .15s var(--courbe); }
button.ap-puce:hover { background: var(--marque-douce); }
.ap-puce button { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: var(--texte-doux); cursor: pointer; }
.ap-puce button:hover { background: var(--bord); color: var(--texte); }
.ap-puce svg { width: 14px; height: 14px; }

/* Parcours publics : réservation, commande, formulaire. */
.ap-parcours { display: grid; gap: 22px; }
.ap-parcours fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 12px; animation: ap-apparait .35s var(--courbe) both; }
.ap-parcours legend { font-weight: 620; font-size: 16px; padding: 0; margin-bottom: 4px; }
.ap-choix { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); gap: 10px; }
.ap-choix button, .ap-jours button, .ap-heures button { font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--bord); background: var(--surface); border-radius: var(--rayon-petit); transition: border-color .15s var(--courbe), background .15s var(--courbe), transform .15s var(--courbe-ressort); }
.ap-choix button { display: grid; gap: 2px; text-align: left; padding: 12px 14px; }
.ap-choix small { color: var(--texte-doux); }
.ap-choix button:hover, .ap-jours button:hover, .ap-heures button:hover { border-color: var(--marque); }
.ap-choix button:active, .ap-jours button:active, .ap-heures button:active { transform: scale(.97); }
.ap-choix [aria-pressed="true"], .ap-jours [aria-pressed="true"], .ap-heures [aria-pressed="true"] { border-color: var(--marque); background: var(--marque); color: var(--marque-texte); box-shadow: 0 4px 14px -6px var(--marque); }
.ap-choix [aria-pressed="true"] small { color: inherit; opacity: .85; }
.ap-jours { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scroll-snap-type: x mandatory; }
.ap-jours button { flex: 0 0 auto; display: grid; justify-items: center; min-width: 64px; padding: 8px 6px; scroll-snap-align: start; }
.ap-jours small { font-size: 12px; text-transform: capitalize; opacity: .8; }
.ap-jours strong { font-size: 19px; line-height: 1.2; }
.ap-heures { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.ap-heures button { padding: 9px 4px; font-variant-numeric: tabular-nums; font-weight: 550; }
.ap-recapitulatif { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: var(--rayon); background: var(--marque-douce); }
.ap-recapitulatif > span:first-child { font-weight: 550; }
.ap-categorie { font-size: 14px; color: var(--texte-doux); text-transform: uppercase; letter-spacing: .06em; margin-top: 6px; }
.ap-produit { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--bord); }
.ap-produit > div:first-child { display: grid; gap: 2px; }
.ap-quantite { display: flex; align-items: center; gap: 4px; }
.ap-quantite button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--bord-fort); background: var(--surface); color: var(--texte); font: 600 18px/1 var(--police); cursor: pointer; transition: transform .15s var(--courbe-ressort), background .15s; }
.ap-quantite button:last-child { background: var(--marque); border-color: var(--marque); color: var(--marque-texte); }
.ap-quantite button:active { transform: scale(.9); }
.ap-quantite button:disabled { opacity: .35; cursor: default; }
.ap-quantite output { min-width: 26px; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.ap-merci { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 24px 8px; animation: ap-apparait .4s var(--courbe-ressort) both; }
.ap-merci p { color: var(--texte-doux); max-width: 46ch; }
.ap-merci-icone { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--succes-fond); color: var(--succes); }
.ap-merci-icone svg { width: 26px; height: 26px; }
.ap-tarifs { display: grid; gap: 0; }
.ap-tarifs > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px dashed var(--bord-fort); }
.ap-tarifs > div > div { display: grid; gap: 2px; }
.ap-tarifs span { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.ap-horaires { display: grid; margin: 0; }
.ap-horaires > div { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--bord); }
.ap-horaires > div.aujourdhui { font-weight: 650; color: var(--marque-vif); }
.ap-horaires dt, .ap-horaires dd { margin: 0; font-variant-numeric: tabular-nums; }
@keyframes ap-apparait { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .ap-parcours fieldset, .ap-merci { animation: none; } }

.ap-papier { display: none; }
@media print {
  .ap-laterale, .ap-mobile, .ap-bas, .ap-notifs, .ap-sans-impression { display: none !important; }
  /* Une page qui a sa version papier (devis) n'imprime qu'elle. */
  .ap-ecran:has(.ap-papier) > :not(.ap-papier) { display: none !important; }
  .ap-papier { display: block; font-size: 12px; color: #111; line-height: 1.45; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  @page { margin: 14mm; }
  .ap-papier-haut { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 18px; margin-bottom: 22px; border-bottom: 3px solid var(--marque); }
  .ap-papier-logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--marque); color: #fff; font-weight: 700; font-size: 17px; margin-right: 10px; vertical-align: middle; }
  .ap-papier-nom { font-size: 18px; vertical-align: middle; }
  .ap-papier-doux { color: #555; margin-top: 6px; }
  .ap-papier-titre { text-align: right; }
  .ap-papier-titre strong { display: block; font-size: 26px; letter-spacing: .14em; text-transform: uppercase; color: var(--marque); margin-bottom: 4px; }
  .ap-papier-client { margin: 0 0 22px auto; width: 46%; padding: 12px 14px; border-radius: 8px; background: color-mix(in oklab, var(--marque) 6%, #fff); }
  .ap-papier-client small, .ap-papier-signature small { display: block; color: #666; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 2px; }
  .ap-papier-objet { margin-bottom: 12px; }
  .ap-papier-lignes { width: 100%; border-collapse: collapse; }
  .ap-papier-lignes th { padding: 8px; text-align: right; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #fff; background: var(--marque); }
  .ap-papier-lignes th:first-child { text-align: left; border-radius: 6px 0 0 6px; } .ap-papier-lignes th:last-child { border-radius: 0 6px 6px 0; }
  .ap-papier-lignes td { padding: 8px; border-bottom: 1px solid #e3e3e3; text-align: right; font-variant-numeric: tabular-nums; }
  .ap-papier-lignes td:first-child { text-align: left; }
  .ap-papier-lignes tr { break-inside: avoid; }
  .ap-papier-totaux { margin: 16px 0 0 auto; min-width: 280px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
  .ap-papier-totaux td { padding: 4px 8px; } .ap-papier-totaux td:last-child { text-align: right; }
  .ap-papier-ttc td { padding-top: 9px; font-size: 15px; font-weight: 700; border-top: 2px solid var(--marque); color: var(--marque); }
  .ap-papier-notes { margin-top: 22px; white-space: pre-line; }
  .ap-papier-signature { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 26px; break-inside: avoid; }
  .ap-papier-signature > div { height: 90px; border: 1px solid #ccc; border-radius: 8px; padding: 8px 10px; }
  .ap-papier-mentions { margin-top: 26px; font-size: 9.5px; color: #666; white-space: pre-line; }
  .ap-coquille { display: block; }
  .ap-principal { padding: 0; }
  body { background: #fff; color: #000; }
  .ap-carte { box-shadow: none; border-color: #ccc; }
}


/* =====================================================================================================
   Mouvement et finitions (cohérent avec shadcn : bordures fines, anneau de focus, ombres douces).
   Tout se coupe si l'appareil demande moins d'animations.
   ===================================================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
::selection { background: color-mix(in oklab, var(--marque) 25%, transparent); }

/* Changement d'écran : le contenu arrive en cascade. */
.ap-ecran { display: grid; gap: 22px; }
.ap-ecran > * { animation: ap-arrivee .42s var(--courbe) both; }
.ap-ecran > *:nth-child(2) { animation-delay: 40ms; } .ap-ecran > *:nth-child(3) { animation-delay: 80ms; }
.ap-ecran > *:nth-child(4) { animation-delay: 120ms; } .ap-ecran > *:nth-child(5) { animation-delay: 160ms; }
.ap-ecran > *:nth-child(n + 6) { animation-delay: 200ms; }
@keyframes ap-arrivee { from { opacity: 0; transform: translateY(10px); } }
.ap-stats > * { animation: ap-arrivee .5s var(--courbe) both; }
.ap-stats > *:nth-child(2) { animation-delay: 60ms; } .ap-stats > *:nth-child(3) { animation-delay: 120ms; } .ap-stats > *:nth-child(4) { animation-delay: 180ms; }
.ap-tableau tbody tr { animation: ap-ligne .35s var(--courbe) both; }
.ap-tableau tbody tr:nth-child(2) { animation-delay: 30ms; } .ap-tableau tbody tr:nth-child(3) { animation-delay: 60ms; } .ap-tableau tbody tr:nth-child(4) { animation-delay: 90ms; }
.ap-tableau tbody tr:nth-child(5) { animation-delay: 120ms; } .ap-tableau tbody tr:nth-child(n + 6) { animation-delay: 150ms; }
@keyframes ap-ligne { from { opacity: 0; transform: translateY(4px); } }
.ap-tableau tbody tr { transition: background .15s; }
.ap-ligne-saisie { animation: ap-arrivee .3s var(--courbe) both; }

/* Boutons : appui ressenti, reflet discret sur le bouton principal. */
.ap-bouton { transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .12s var(--courbe); }
.ap-bouton:active:not([disabled]) { transform: scale(.97); }
.ap-bouton.primaire { box-shadow: inset 0 1px 0 rgb(255 255 255 / .18), 0 1px 2px color-mix(in oklab, var(--marque) 40%, transparent); }
.ap-bouton:focus-visible { outline: none; box-shadow: var(--anneau); }
.ap-bouton svg { transition: transform .2s var(--courbe); }
.ap-bouton:hover svg[data-icone="fleche"], .ap-bouton:hover svg[data-icone="plus"] { transform: translateX(1px) rotate(var(--rot, 0)); }
.ap-bouton:hover svg[data-icone="plus"] { --rot: 90deg; transform: rotate(90deg); }
.ap-bouton .ap-coche-ok { animation: ap-pop .35s var(--courbe-ressort) both; }
@keyframes ap-pop { from { opacity: 0; transform: scale(.4); } }

/* Champs : anneau de focus animé. */
.ap-saisie { transition: border-color .15s, box-shadow .2s var(--courbe), background .15s; }
.ap-saisie:hover:not(:focus) { border-color: color-mix(in oklab, var(--bord-fort) 60%, var(--texte-pale)); }
.ap-saisie:focus { box-shadow: var(--anneau); }

/* Cartes cliquables : légère levée. */
.ap-carte { transition: border-color .2s, box-shadow .25s var(--courbe), transform .25s var(--courbe); }
.ap-carte.interactive { cursor: pointer; }
.ap-carte.interactive:hover { transform: translateY(-2px); box-shadow: var(--ombre-haute); border-color: var(--bord-fort); }
.ap-stat-valeur { transition: color .2s; }

/* Navigation : pastille active qui se pose, barre de marque à gauche. */
.ap-nav a { position: relative; transition: background .15s, color .15s; }
.ap-nav a::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--marque); transform: scaleY(0); transition: transform .25s var(--courbe-ressort); }
.ap-nav a[aria-current="page"]::before { transform: scaleY(1); }
.ap-nav a svg { transition: transform .2s var(--courbe); }
.ap-nav a:hover svg { transform: scale(1.08); }

/* Onglets : soulignement qui glisse d'un onglet à l'autre. */
.ap-onglets { position: relative; }
.ap-onglets button { border-bottom-color: transparent !important; transition: color .15s; }
.ap-onglets-trait { position: absolute; bottom: -1px; height: 2px; border-radius: 2px; background: var(--marque); transition: left .3s var(--courbe), width .3s var(--courbe); }

/* Badges d'état : apparition douce quand l'état change. */
.ap-badge { animation: ap-pop-doux .3s var(--courbe) both; }
@keyframes ap-pop-doux { from { opacity: 0; transform: scale(.85); } }

/* Dialogues et tiroirs : entrée et sortie animées. */
dialog.ap-dialogue { transition: opacity .18s var(--courbe), transform .2s var(--courbe), overlay .2s allow-discrete, display .2s allow-discrete; }
dialog.ap-dialogue[open] { animation: none; }
dialog.ap-dialogue[open]:not(.sortie) { opacity: 1; transform: none; }
@starting-style { dialog.ap-dialogue[open] { opacity: 0; transform: translateY(8px) scale(.97); } }
dialog.ap-dialogue.sortie { opacity: 0; transform: translateY(6px) scale(.98); }
dialog.ap-dialogue::backdrop { transition: background .2s, backdrop-filter .2s, overlay .2s allow-discrete, display .2s allow-discrete; }
@starting-style { dialog.ap-dialogue[open]::backdrop { background: transparent; backdrop-filter: none; } }
dialog.ap-dialogue.sortie::backdrop { background: transparent; backdrop-filter: none; }
dialog.ap-tiroir { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(480px, 100vw); border-radius: 16px 0 0 16px; display: grid; grid-template-rows: auto 1fr auto; }
dialog.ap-tiroir:not([open]) { display: none; }
@starting-style { dialog.ap-tiroir[open] { opacity: 1; transform: translateX(40px); } }
dialog.ap-tiroir.sortie { transform: translateX(40px); }
dialog.ap-tiroir .ap-dialogue-corps { overflow-y: auto; }
dialog.ap-tiroir .ap-dialogue-pied { border-radius: 0 0 0 16px; }
@media (max-width: 640px) {
  dialog.ap-tiroir { margin: auto 0 0; width: 100vw; max-width: 100vw; height: auto; max-height: 92dvh; border-radius: 18px 18px 0 0; }
  @starting-style { dialog.ap-tiroir[open] { transform: translateY(40px); } }
  dialog.ap-tiroir.sortie { transform: translateY(40px); }
  dialog.ap-tiroir .ap-dialogue-pied { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  dialog.ap-dialogue:not(.ap-tiroir) { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; }
}

/* Notifications : arrivent par le bas, repartent en glissant. */
.ap-notif { animation: ap-notif-in .35s var(--courbe-ressort) both; transition: opacity .2s, transform .2s var(--courbe); }
.ap-notif.sortie { opacity: 0; transform: translateX(16px); }
@keyframes ap-notif-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }

/* Barre de chargement en haut de l'écran pendant qu'on va chercher les données. */
.ap-barre { position: fixed; z-index: 200; top: 0; left: 0; right: 0; height: 2px; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .3s; }
.ap-barre.active { opacity: 1; }
.ap-barre::after { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, var(--marque), transparent); animation: ap-barre 1s var(--courbe) infinite; }
@keyframes ap-barre { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* État vide : l'icône respire une fois. */
.ap-vide-icone { position: relative; animation: ap-pop .5s var(--courbe-ressort) both; }
.ap-vide-icone::after { content: ""; position: absolute; inset: -6px; border-radius: 16px; border: 1px solid color-mix(in oklab, var(--marque) 30%, transparent); animation: ap-onde 1.6s var(--courbe) .3s both; }
@keyframes ap-onde { from { opacity: 1; transform: scale(.85); } to { opacity: 0; transform: scale(1.25); } }

/* Infobulles : <button data-infobulle="Imprimer">. */
[data-infobulle] { position: relative; }
[data-infobulle]:hover::after, [data-infobulle]:focus-visible::after { content: attr(data-infobulle); position: absolute; z-index: 50; bottom: calc(100% + 8px); left: 50%; translate: -50% 0; padding: 5px 8px; border-radius: 6px; background: var(--texte); color: var(--fond); font-size: 12px; font-weight: 500; white-space: nowrap; pointer-events: none; animation: ap-pop-doux .15s var(--courbe) both; }

/* Menu déroulant. */
.ap-menu { position: relative; display: inline-block; }
.ap-menu-liste { position: absolute; z-index: 60; right: 0; top: calc(100% + 6px); min-width: 200px; padding: 4px; border-radius: 10px; border: 1px solid var(--bord); background: var(--surface); box-shadow: var(--ombre-haute); transform-origin: top right; animation: ap-menu .16s var(--courbe) both; }
@keyframes ap-menu { from { opacity: 0; transform: scale(.95) translateY(-4px); } }
.ap-menu-liste button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--texte); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.ap-menu-liste button:hover, .ap-menu-liste button:focus-visible { background: var(--surface-2); outline: none; }
.ap-menu-liste button.danger { color: var(--danger); }
.ap-menu-liste svg { width: 16px; height: 16px; }

/* Palette de commandes (Ctrl ou ⌘ + K). */
dialog.ap-palette { width: min(600px, calc(100vw - 24px)); margin: 12vh auto auto; padding: 0; border: 1px solid var(--bord); border-radius: 14px; background: var(--surface); color: var(--texte); box-shadow: var(--ombre-haute); overflow: hidden; }
dialog.ap-palette::backdrop { background: rgb(10 10 16 / .35); backdrop-filter: blur(3px); }
dialog.ap-palette[open] { animation: ap-palette .2s var(--courbe) both; }
@keyframes ap-palette { from { opacity: 0; transform: scale(.97) translateY(-6px); } }
.ap-palette-saisie { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--bord); }
.ap-palette-saisie svg { width: 18px; height: 18px; color: var(--texte-pale); }
.ap-palette-saisie input { flex: 1; height: 52px; border: 0; background: none; color: var(--texte); font: inherit; font-size: 16px; outline: none; }
.ap-palette-liste { max-height: 360px; overflow-y: auto; padding: 6px; }
.ap-palette-groupe { padding: 8px 10px 4px; font-size: 12px; font-weight: 550; color: var(--texte-pale); }
.ap-palette-liste button { display: flex; width: 100%; align-items: center; gap: 12px; padding: 10px; border: 0; border-radius: 8px; background: none; color: var(--texte); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.ap-palette-liste button[aria-selected="true"] { background: var(--marque-douce); color: var(--marque-vif); }
.ap-palette-liste svg { width: 17px; height: 17px; }
.ap-palette-pied { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--bord); font-size: 12px; color: var(--texte-pale); background: var(--surface-2); }
kbd { font: 500 11px/1 var(--police); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--bord-fort); background: var(--surface); color: var(--texte-doux); }
.ap-raccourci { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 36px; padding: 0 8px 0 10px; border: 1px solid var(--bord); border-radius: var(--rayon-petit); background: var(--surface-2); color: var(--texte-pale); font: inherit; font-size: 13.5px; cursor: pointer; margin-bottom: 10px; transition: border-color .15s, color .15s; }
.ap-raccourci:hover { border-color: var(--bord-fort); color: var(--texte-doux); }
.ap-raccourci span { display: flex; align-items: center; gap: 8px; }
.ap-raccourci svg { width: 15px; height: 15px; }

/* Chiffres qui s'animent quand ils changent. */
.ap-chiffre { font-variant-numeric: tabular-nums; display: inline-block; }
.ap-chiffre.change { animation: ap-chiffre .4s var(--courbe); }
@keyframes ap-chiffre { 30% { color: var(--marque-vif); } }
