/* =========================================================
   pricing.css — page « Abonnement » (views/pricing.js, #/abonnement). Préfixe propre : .tp-pr-
   Pièces : en-tête + illustration, bandeau de retour de paiement (__return--waiting|done|slow), panneau « Ton abonnement »
   (.tp-pr-status--free|pro|warn, badge, jauges d'utilisation), bascule Mensuel / Annuel (.tp-pr-toggle[data-value]),
   cartes de formules (.tp-pr-plan--free|pro, .is-current), prix, listes, comparatif (.tp-pr-table), FAQ (<details>).
   Réutilise : .tp-page, .tp-page-head, .tp-section, .tp-button(--sun|--lg|--block), .tp-alert, .tp-skeleton, .tp-empty.
   ========================================================= */

.tp-pricing { max-width: 1040px; }

/* ---------- Head ---------- */
.tp-pr-head { flex-wrap: nowrap; align-items: center; margin-bottom: 18px; }
.tp-pr-head__text { min-width: 0; }
.tp-pr-head__lead { max-width: 60ch; margin-top: 6px; color: var(--tp-text-subtle); font-size: 15px; line-height: 22px; }
.tp-pr-head__art { width: 112px; height: auto; flex: none; animation: tp-float 3.4s ease-in-out infinite; }

/* ---------- Back from Stripe ---------- */
.tp-pr-return {
  --tp-ret-bg: var(--tp-blue-bg); --tp-ret-edge: var(--tp-accent-edge); --tp-ret-fg: var(--tp-blue-text);
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 12px 14px;
  border: 1px solid var(--tp-ret-edge); border-radius: var(--tp-radius-lg); background: var(--tp-ret-bg); box-shadow: var(--tp-shadow-pop);
  animation: tp-spring-in 320ms var(--tp-spring);
}
.tp-pr-return[hidden] { display: none; }
.tp-pr-return--done { --tp-ret-bg: var(--tp-mint-bg); --tp-ret-edge: var(--tp-mint-edge); --tp-ret-fg: var(--tp-mint-text); }
.tp-pr-return--slow { --tp-ret-bg: var(--tp-sun-bg); --tp-ret-edge: var(--tp-sun-edge); --tp-ret-fg: var(--tp-sun-text); }
.tp-pr-return__icon {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none; border: 1px solid var(--tp-line); border-radius: var(--tp-radius);
  background: var(--tp-surface); color: var(--tp-ret-fg); box-shadow: var(--tp-shadow-raised);
}
.tp-pr-return--done .tp-pr-return__icon { background: var(--tp-sun); color: #2a1f02; animation: tp-wiggle 600ms var(--tp-ease) 300ms 2; }
.tp-pr-return__icon .tp-icon { width: 20px; height: 20px; }
.tp-pr-return > .tp-spinner { margin: 0 6px; }
.tp-pr-return__body { display: flex; flex-direction: column; flex: 1; min-width: 0; color: var(--tp-text); }
.tp-pr-return__body strong { color: var(--tp-ret-fg); font-family: var(--tp-font); font-size: 16px; font-weight: 800; }

/* ---------- « Ton abonnement » ---------- */
.tp-pr-status {
  --tp-st-accent: var(--tp-gray);
  position: relative; margin-bottom: 22px; padding: 18px 18px 16px; overflow: hidden;
  border: 1px solid var(--tp-line); border-radius: var(--tp-radius-xl); background: var(--tp-surface); box-shadow: var(--tp-shadow-pop);
}
.tp-pr-status::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 6px; background: var(--tp-st-accent); }
.tp-pr-status--pro { --tp-st-accent: var(--tp-sun); }
.tp-pr-status--warn { --tp-st-accent: var(--tp-coral); }
.tp-pr-status--free { --tp-st-accent: var(--tp-accent); }
.tp-pr-status__main { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.tp-pr-status__text { display: flex; flex-direction: column; gap: 4px; flex: 1 1 320px; min-width: 0; }
.tp-pr-status__kicker { display: flex; align-items: center; gap: 8px; color: var(--tp-text-subtlest); font-size: 12px; line-height: 16px; font-weight: 700; }
.tp-pr-status__title { font-size: 20px; line-height: 26px; }
.tp-pr-status--warn .tp-pr-status__title { color: var(--tp-coral-text); }
.tp-pr-status__detail { max-width: 64ch; color: var(--tp-text-subtle); }
.tp-pr-status__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.tp-pr-status__sync { font-size: 12px; font-weight: 700; }
.tp-pr-status__sync .tp-icon { width: 13px; height: 13px; }
.tp-pr-status__sync.is-busy { opacity: 0.7; pointer-events: none; }
.tp-pr-status__sync .tp-spinner { width: 12px; height: 12px; border-width: 2px; }

.tp-pr-badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border: 1px solid var(--tp-line); border-radius: 999px;
  background: var(--tp-surface-3); color: var(--tp-text-strong); font-family: var(--tp-font); font-size: 12px; font-weight: 800; letter-spacing: 0.02em;
}
.tp-pr-badge--pro { border-color: var(--tp-sun-edge); background: var(--tp-sun-bg); color: var(--tp-sun-text); }
.tp-pr-badge .tp-icon { width: 13px; height: 13px; color: var(--tp-sun); }

/* Usage meters */
.tp-pr-usage { margin-top: 16px; padding-top: 14px; border-top: 1.5px dashed var(--tp-border); }
.tp-pr-usage__title { margin-bottom: 10px; color: var(--tp-text-subtle); font-family: var(--tp-font); font-size: 13px; font-weight: 800; letter-spacing: 0.02em; }
.tp-pr-meters { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 12px 18px; list-style: none; }
.tp-pr-meter { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-width: 0; } /* bars aligned on a row */
/* Label and value never cut: when both don't fit on one line (« AI actions today » + « 0 · unlimited with your key »,
   long French labels), the value goes under the label, on the right; a label longer than the tile wraps. */
.tp-pr-meter__top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 8px; font-size: 12px; line-height: 16px; }
.tp-pr-meter__label { min-width: 0; color: var(--tp-text-subtle); overflow-wrap: anywhere; }
.tp-pr-meter__val { flex: none; max-width: 100%; margin-left: auto; color: var(--tp-text-subtlest); text-align: right; font-variant-numeric: tabular-nums; }
.tp-pr-meter__val strong { color: var(--tp-text-strong); font-family: var(--tp-font); font-size: 14px; font-weight: 800; }
.tp-pr-meter__bar {
  position: relative; display: block; height: 10px; overflow: hidden; border: 1px solid var(--tp-line); border-radius: 999px; background: var(--tp-bg-sunken);
}
.tp-pr-meter__bar > span {
  position: absolute; inset: 0; border-radius: inherit; background: var(--tp-accent);
  transform: scaleX(0); transform-origin: left center; transition: transform 700ms var(--tp-ease-out), background-color 200ms var(--tp-ease);
}
.tp-pr-meter.is-warn .tp-pr-meter__bar > span { background: var(--tp-sun); }
.tp-pr-meter.is-full .tp-pr-meter__bar > span { background: var(--tp-coral); }
.tp-pr-meter.is-full .tp-pr-meter__val strong { color: var(--tp-coral-text); }
.tp-pr-meter.is-unlimited .tp-pr-meter__bar { border-style: dashed; background: transparent; }
.tp-pr-meter.is-unlimited .tp-pr-meter__bar > span { display: none; }
.tp-pr-usage__hint { margin-top: 10px; color: var(--tp-text-subtlest); font-size: 12px; line-height: 16px; }

/* ---------- Not configured ---------- */
.tp-pr-config { margin-bottom: 22px; }
.tp-pr-config strong { margin-bottom: 2px; }

/* ---------- Monthly / yearly switch ---------- */
.tp-pr-offer__bar { display: flex; justify-content: center; margin-bottom: 22px; }
.tp-pr-offer__bar:empty { display: none; }
.tp-pr-toggle {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; min-width: 300px;
  border: 1px solid var(--tp-line); border-radius: 999px; background: var(--tp-bg-sunken); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}
.tp-pr-toggle__thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border: 1px solid var(--tp-accent-edge); border-radius: 999px;
  background: var(--tp-accent); box-shadow: var(--tp-shadow-raised); transition: transform 320ms var(--tp-spring);
}
.tp-pr-toggle[data-value="an"] .tp-pr-toggle__thumb { transform: translateX(100%); }
.tp-pr-toggle__opt { position: relative; z-index: 1; display: flex; }
.tp-pr-toggle__opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tp-pr-toggle__opt > span {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 36px; padding: 4px 16px;
  border-radius: 999px; color: var(--tp-text-subtle); font-family: var(--tp-font); font-size: 15px; font-weight: 700; white-space: nowrap;
  transition: color 200ms var(--tp-ease);
}
.tp-pr-toggle__opt:hover > span { color: var(--tp-text-strong); }
.tp-pr-toggle__opt input:checked + span { color: var(--tp-accent-text); }
.tp-pr-toggle__opt input:focus-visible + span { outline: 2px solid var(--tp-accent-hover); outline-offset: 2px; }
.tp-pr-save {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border: 1px solid var(--tp-sun-edge); border-radius: 999px;
  background: var(--tp-sun); color: #2a1f02; font-size: 11px; font-weight: 700; line-height: 1;
}

/* ---------- Plan cards ---------- */
.tp-pr-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 20px; align-items: stretch; }
.tp-pr-plan {
  position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 22px 20px 20px;
  border: 1px solid var(--tp-line); border-radius: var(--tp-radius-xl); background: var(--tp-surface); box-shadow: var(--tp-shadow-pop);
  transition: transform 220ms var(--tp-spring), box-shadow 200ms var(--tp-ease);
}
.tp-pr-plan:hover { transform: translateY(-2px); box-shadow: var(--tp-shadow-pop-lg); }
.tp-pr-plan--pro { border-color: var(--tp-sun-edge); background: #171d2b; box-shadow: 0 0 0 1px var(--tp-sun-edge), var(--tp-shadow-pop); }
.tp-pr-plan--pro:hover { box-shadow: 0 0 0 1px var(--tp-sun-edge), var(--tp-shadow-pop-lg); }
.tp-pr-plan__ribbon {
  position: absolute; top: -14px; right: 18px; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 11px;
  border: 1px solid var(--tp-sun-edge); border-radius: 999px; background: var(--tp-sun); color: #2a1f02;
  font-family: var(--tp-font); font-size: 13px; font-weight: 800; box-shadow: var(--tp-shadow-raised);
}
.tp-pr-plan__ribbon .tp-icon { width: 14px; height: 14px; }
.tp-pr-plan__head { display: flex; flex-direction: column; gap: 2px; }
.tp-pr-plan__name { font-size: 22px; line-height: 28px; }
.tp-pr-plan--pro .tp-pr-plan__name { color: var(--tp-sun-text); }
.tp-pr-plan__pitch { color: var(--tp-text-subtle); }
.tp-pr-plan__price { min-height: 76px; }
.tp-pr-plan__price.is-flip { animation: tp-pr-flip 300ms var(--tp-spring); }
@keyframes tp-pr-flip { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
.tp-pr-plan__cta { margin-top: 4px; }
.tp-pr-plan--skeleton { gap: 14px; min-height: 360px; }
.tp-pr-plan--skeleton:hover { transform: none; box-shadow: var(--tp-shadow-pop); }
.tp-pr-plan--skeleton .tp-skeleton--block { height: 64px; }

.tp-pr-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: 4px; }
.tp-pr-price__amount { color: var(--tp-text-strong); font-family: var(--tp-font); font-size: 40px; line-height: 46px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tp-pr-price__per { color: var(--tp-text-subtle); font-weight: 700; }
.tp-pr-price__sub { color: var(--tp-text-subtlest); font-size: 13px; line-height: 18px; }
.tp-pr-plan--pro .tp-pr-price__sub { color: var(--tp-mint-text); font-weight: 700; }
.tp-pr-price__ind { color: var(--tp-text-subtlest); font-weight: 400; }

.tp-pr-current {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 12px;
  border: 1.5px dashed #34415c; border-radius: var(--tp-radius); color: var(--tp-text); font-family: var(--tp-font); font-weight: 800; text-align: center;
}
.tp-pr-current .tp-icon { color: var(--tp-mint); }
.tp-pr-current--pro { border-color: var(--tp-sun-edge); color: var(--tp-sun-text); }
.tp-pr-current--pro .tp-icon { color: var(--tp-sun); }
.tp-pr-current--muted { border-style: dotted; color: var(--tp-text-subtle); font-family: var(--tp-font); font-size: 13px; font-weight: 400; }
.tp-pr-secure { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--tp-text-subtlest); font-size: 12px; line-height: 16px; }
.tp-pr-secure .tp-icon { width: 13px; height: 13px; }

.tp-pr-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; list-style: none; }
.tp-pr-list li { display: flex; align-items: flex-start; gap: 9px; color: var(--tp-text); line-height: 20px; }
.tp-pr-list .tp-icon { width: 17px; height: 17px; margin-top: 2px; color: var(--tp-text-subtle); }
.tp-pr-list--pro li { color: var(--tp-text-strong); }
.tp-pr-list--pro .tp-icon { color: var(--tp-mint); }
.tp-pr-list__lead { margin-top: 8px; padding-top: 12px; border-top: 1.5px dashed var(--tp-border); color: var(--tp-text-subtle); font-size: 13px; font-weight: 700; }

/* ---------- Full comparison ---------- */
.tp-pr-compare { margin-top: 40px; }
.tp-pr-table { overflow: hidden; border: 1px solid var(--tp-line); border-radius: var(--tp-radius-lg); background: var(--tp-surface); box-shadow: var(--tp-shadow-raised); }
.tp-pr-table__row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 12px; padding: 11px 16px; }
.tp-pr-table__row + .tp-pr-table__row { border-top: 1px solid var(--tp-border); }
.tp-pr-table__row:not(.tp-pr-table__row--head):hover { background: var(--tp-hover); }
.tp-pr-table__row--head { background: var(--tp-bg-sunken); color: var(--tp-text-subtle); font-family: var(--tp-font); font-weight: 800; }
.tp-pr-table__pro { display: inline-flex; align-items: center; gap: 6px; color: var(--tp-sun-text); }
.tp-pr-table__pro .tp-icon { width: 15px; height: 15px; color: var(--tp-sun); }
.tp-pr-table__label { color: var(--tp-text-strong); font-weight: 700; }
.tp-pr-table__row--head .tp-pr-table__label { color: var(--tp-text-subtle); font-weight: 600; }
.tp-pr-cell { display: inline-flex; align-items: flex-start; gap: 6px; color: var(--tp-text); }
.tp-pr-cell .tp-icon { width: 15px; height: 15px; margin-top: 2px; }
.tp-pr-cell--no { color: var(--tp-text-subtlest); }
.tp-pr-cell--yes .tp-icon { color: var(--tp-mint); }
.tp-pr-cell--pro { color: var(--tp-text-strong); font-weight: 700; }

/* ---------- FAQ ---------- */
.tp-pr-faq { margin-top: 40px; }
.tp-pr-faq__list { display: flex; flex-direction: column; gap: 10px; max-width: 820px; }
.tp-pr-faq__item {
  border: 1px solid var(--tp-line); border-radius: var(--tp-radius-lg); background: var(--tp-surface); box-shadow: var(--tp-shadow-raised);
  transition: background-color var(--tp-dur) var(--tp-ease);
}
.tp-pr-faq__item[open] { background: var(--tp-surface-2); }
.tp-pr-faq__item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: inherit;
  color: var(--tp-text-strong); font-family: var(--tp-font); font-size: 15px; font-weight: 800; cursor: pointer; list-style: none;
}
.tp-pr-faq__item summary::-webkit-details-marker { display: none; }
.tp-pr-faq__item summary:hover { color: #fff; }
.tp-pr-faq__item summary:focus-visible { outline-offset: -2px; }
.tp-pr-faq__chev { flex: none; color: var(--tp-text-subtle); transition: transform 260ms var(--tp-spring); }
.tp-pr-faq__item[open] .tp-pr-faq__chev { transform: rotate(180deg); }
.tp-pr-faq__item p { padding: 0 14px 14px; color: var(--tp-text); max-width: 72ch; }
.tp-pr-faq__item[open] p { animation: tp-rise 240ms var(--tp-ease-out); }

/* ---------- Small screens ---------- */
@media (max-width: 599px) {
  .tp-pr-head__art { width: 72px; }
  .tp-pr-head__lead { font-size: 14px; line-height: 20px; }
  .tp-pr-status { padding: 16px 14px 14px 18px; }
  .tp-pr-status__actions { width: 100%; }
  .tp-pr-status__actions .tp-button { flex: 1; }
  .tp-pr-toggle { min-width: 0; width: 100%; }
  .tp-pr-toggle__opt > span { padding: 4px 8px; font-size: 14px; }
  .tp-pr-plan { padding: 20px 16px 16px; }
  .tp-pr-price__amount { font-size: 34px; line-height: 40px; }
  .tp-pr-return { flex-wrap: wrap; }
  .tp-pr-return__body { flex-basis: calc(100% - 60px); }
  .tp-pr-table__row--head { display: none; }
  .tp-pr-table__row { grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .tp-pr-table__row + .tp-pr-table__row { border-top: 0; }
  .tp-pr-table__row:not(:first-child) { border-top: 1px solid var(--tp-border); }
  .tp-pr-table__row:nth-child(2) { border-top: 0; }
  .tp-pr-table__label { grid-column: 1 / -1; }
  .tp-pr-table [data-col]::before {
    content: attr(data-col); display: block; margin-bottom: 2px; color: var(--tp-text-subtlest); font-size: 11px; line-height: 14px; font-weight: 700;
  }
  .tp-pr-table [data-col="Pro"]::before { color: var(--tp-sun-text); }
}

@media (prefers-reduced-motion: reduce) {
  .tp-pr-head__art, .tp-pr-return--done .tp-pr-return__icon { animation: none; }
  .tp-pr-plan:hover { transform: none; }
}
