/* ==========================================================================
   CODE LIBERTÉ — portail affilié (/affilie, /espace)
   S'appuie sur les tokens de landing.css (crème / noir / doré, Montserrat).
   Mobile d'abord.
   ========================================================================== */

.portal__main {
  min-height: 100vh;
  display: grid; place-items: center; grid-template-columns: minmax(0, 1fr);
  padding: 32px 0 48px;
}
.portal__main--top { place-items: start center; min-height: auto; padding-top: 8px; }

.card {
  width: min(100% - (var(--gutter) * 2), 560px); margin-inline: auto;
  padding: clamp(24px, 6vw, 44px) clamp(20px, 5vw, 40px);
  background: var(--surface);
  border: 1px solid rgba(228, 218, 209, .9);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 70px -24px rgba(var(--warm-shadow), .30);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.card--msg { text-align: center; }
.card--msg p { margin-bottom: 10px; }
.card__logo { width: 100%; max-width: 360px; margin: 0 auto 26px; border-radius: var(--r-sm);
  box-shadow: 0 14px 34px rgba(var(--warm-shadow), .14); }
.card__actions { margin-top: 24px; }
.card__actions .btn { min-height: 50px; font-size: 15px; padding-inline: 26px; }

.title {
  margin: 8px 0 18px;
  font-size: clamp(26px, 6.6vw, 36px); line-height: 1.15; letter-spacing: -.026em; font-weight: 700;
  color: var(--ink); text-wrap: balance;
}
.title--sm { font-size: clamp(22px, 5.6vw, 28px); }
.title .gold, .gold-inline {
  color: var(--gold-deep);
  background: linear-gradient(105deg, #A57B3C, var(--gold) 46%, var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.title .gold { display: block; }

.steps { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.5; }
.steps span {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--gold-light), var(--gold) 55%, var(--gold-deep));
}

/* ---------- Formulaire ---------- */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field__label { font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--ink); }
.field__input {
  width: 100%; min-height: 52px; padding: 0 16px;
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface-solid);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .2s, box-shadow .2s;
}
.field__input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 164, 107, .22); }
/* liste deroulante (pays de residence) : meme champ, fleche dessinee */
.field__select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 44px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a7a45' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 16px 16px;
}
.field__help { font-size: 12.5px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.field__help .mono { display: block; font-size: 12px; }
.field__help b { color: var(--gold-text); font-weight: 700; }
.mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: .95em; }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.btn--block { width: 100%; padding-inline: 20px; }
.btn[disabled] { opacity: .6; pointer-events: none; }
.fine { font-size: 12.5px; color: var(--muted); line-height: 1.55; text-align: center; }
.aside { margin-top: 22px; font-size: 13px; color: var(--muted); text-align: center; line-height: 1.55; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.notice {
  margin: 0 0 18px; padding: 12px 14px; border-radius: var(--r-sm);
  font-size: 14px; line-height: 1.5; border: 1px solid var(--line); background: var(--glass);
}
.notice--error { border-color: #E2B8AE; background: #FBF0EC; color: #7A2E1E; }
.notice--info  { border-color: var(--gold-light); background: #FBF6EA; color: var(--gold-text); }
.notice--ok    { border-color: #BFD8C3; background: #EFF7F0; color: #24532E; }

/* ---------- Espace ---------- */
.topbar {
  width: min(100% - (var(--gutter) * 2), 1440px); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 0 4px;
}
.topbar__brand img { width: 150px; border-radius: 8px; }
.link-btn {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; cursor: pointer;
}
.link-btn:hover { border-color: var(--ink); }

.dash { width: min(100% - (var(--gutter) * 2), 1600px); margin-inline: auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.dash .card { width: 100%; }
.dash__head .title { margin-bottom: 4px; }
.dash__full { margin: 0 0 4px; display: flex; justify-content: flex-end; }
.dash__full .btn { min-height: 44px; padding-inline: 22px; font-size: 14px; gap: 8px; text-decoration: none; }

.copy { display: flex; gap: 8px; margin-top: 10px; }
.copy__input {
  flex: 1; min-width: 0; min-height: 50px; padding: 0 14px;
  color: var(--ink); background: var(--surface-solid);
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.copy__btn { min-height: 50px; padding: 0 20px; font-size: 15px; }
.copy__btn.is-done { background: var(--gold-deep); }

.state { display: flex; align-items: center; gap: 10px; margin: 8px 0 6px; font-weight: 700; color: var(--ink); font-size: 17px; }
.state i { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.state--ok i { background: #3E8E52; box-shadow: 0 0 0 4px rgba(62, 142, 82, .16); }
.state--warn i { background: var(--gold); box-shadow: 0 0 0 4px rgba(201, 164, 107, .22); }
.state--bad i { background: #B5503A; }
.card--state .muted { font-size: 14px; margin-bottom: 16px; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat {
  padding: 16px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid rgba(228, 218, 209, .9);
  display: grid; gap: 2px;
}
.stat__v { font-size: clamp(19px, 5vw, 24px); font-weight: 700; color: var(--ink); letter-spacing: -.02em; line-height: 1.25; }
.stat__l { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.stat--gold { background: linear-gradient(135deg, #FBF6EA, #F3E7CB); border-color: var(--gold-light); }
.stat--gold .stat__v { color: var(--gold-deep); }
.stats .stat:first-child { grid-column: 1 / -1; }

/* selecteur de periode : pilule defilante sur mobile, au pouce */
.periods {
  position: relative; display: flex; gap: 4px; padding: 4px; overflow-x: auto; scroll-margin-top: 12px;
  background: var(--surface); border: 1px solid rgba(228, 218, 209, .9); border-radius: 999px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
}
.periods::-webkit-scrollbar { display: none; }
.periods:focus, .periods:focus-visible { outline: none; }   /* ancre #chiffres : pas de contour sur la barre, les liens gardent le leur */
.periods__i {
  flex: none; display: inline-flex; align-items: center; min-height: 38px; padding: 0 15px;
  border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none;
  white-space: nowrap; scroll-snap-align: center; transition: background .2s, color .2s;
}
.periods__i:hover { color: var(--ink); }
.periods__i:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.periods__i[aria-current="page"] { background: var(--ink); color: #fff; box-shadow: 0 4px 12px rgba(21, 18, 16, .22); }

.sales { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.sales thead { display: none; }
.sales tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sales tr:last-child { border-bottom: 0; }
.sales td { padding: 0; }
.sales td[data-l="Date"] { color: var(--muted); font-size: 13px; }
.sales td[data-l="Formule"] { text-align: right; }
.sales td[data-l="Montant"] { color: var(--muted); }
.sales td[data-l="Montant"]::after { content: " encaissés"; }
.sales td[data-l="Commission"] { text-align: right; color: var(--ink); }
.sales td[data-l="Statut"] { grid-column: 1 / -1; }
/* coordonnees de l'acheteur : une ligne pleine largeur sous le statut (telephone), une colonne des 640 px */
.sales td.buyer { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 13px; color: var(--muted); min-width: 0; }
.sales td.buyer--none { display: none; }
.buyer__n { color: var(--ink); font-weight: 600; }
.buyer__c { color: inherit; text-decoration: none; overflow-wrap: anywhere; user-select: text; }
.buyer__c:hover { color: var(--ink); text-decoration: underline; }
.plan { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--glass); border: 1px solid var(--line); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill--ok { background: #EFF7F0; color: #24532E; }
.pill--warn { background: #FBF6EA; color: var(--gold-text); }
.pill--bad { background: #FBF0EC; color: #7A2E1E; }
.pill--muted { background: var(--glass); color: var(--muted); }
.empty { margin-top: 10px; color: var(--muted); font-size: 14px; }

/* des 640 px, et donc dans la colonne Circle sur ordinateur : vraie table et filtres etires, pas la mise en page
   telephone (c'etait le reproche de Theo : « petit format mobile » dans Circle) */
@media (min-width: 640px) {
  .periods__i { flex: 1 1 auto; justify-content: center; }
  .sales thead { display: table-header-group; }
  .sales th { text-align: left; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 8px 8px 10px 0; border-bottom: 1px solid var(--line); }
  .sales tr { display: table-row; }
  .sales td { padding: 12px 8px 12px 0; border-bottom: 1px solid var(--line); }
  .sales tbody tr:last-child td { border-bottom: 0; }
  .sales td[data-l="Formule"], .sales td[data-l="Commission"] { text-align: left; }
  .sales td[data-l="Montant"]::after { content: none; }
  .sales .num { text-align: right; }
  .sales th.num { text-align: right; }
  .sales td.buyer { display: table-cell; }
  .sales td.buyer--none { display: table-cell; }
  .buyer__n, .buyer__c { display: block; }
  /* 6 chiffres : 3 par ligne des 640 px (dans Circle aussi), 6 sur une ligne en pleine largeur */
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats .stat:first-child { grid-column: auto; }
}

/* pleine largeur navigateur : deux colonnes de cartes, les chiffres et les ventes prennent la place disponible */
@media (min-width: 1024px) {
  .stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .dash { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 18px; row-gap: 18px; }
  .tabs { max-width: 560px; }
  .vt { max-width: 560px; }
  .card--account .kv { grid-template-columns: minmax(0, 1fr); }
  .dash > * { grid-column: 1 / -1; }
  .card--link { grid-column: span 7; }
  .card--state { grid-column: span 5; }
  .dash:not(:has(.card--link)) .card--state { grid-column: 1 / -1; }
  .card--sales { grid-column: span 8; }
  .card--account { grid-column: span 4; }
  .picks { max-width: 860px; margin-inline: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .field__input, .copy__btn { transition: none; }
}

/* ---------- Comptes (connexion, mot de passe, Mon compte) ---------- */
.card--narrow { width: min(100% - (var(--gutter) * 2), 460px); }
.form__row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 520px) { .form__row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
.steps li div { min-width: 0; }
.steps li b { color: var(--ink); font-weight: 700; }
.field__help--live:empty { display: none; }
.field__help--live.is-ok { color: #24532E; font-weight: 600; }
.field__help--live.is-bad { color: #7A2E1E; font-weight: 600; }
.alink { color: var(--gold-text); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.alink:hover { color: var(--ink); }
.aside--tight { margin-top: 6px; }
.lead-sm { font-size: 14px; line-height: 1.55; margin: -6px 0 18px; }
.card--state .small { margin: 12px 0 0; }
.kv { margin: 8px 0 14px; display: grid; gap: 10px; }
.kv div { display: grid; gap: 2px; }
.kv dt { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.kv dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.acc { border-top: 1px solid var(--line); padding-top: 12px; }
.acc summary { cursor: pointer; font-weight: 700; color: var(--ink); font-size: 15px; padding: 4px 0; list-style-position: inside; }
.acc[open] summary { margin-bottom: 14px; }
.form--tight { gap: 14px; }
@media (min-width: 720px) { .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Periodes precises (jour / mois / annee), bascule Net / Brut, statut reel des commissions ---------- */
.periodbox { display: grid; gap: 8px; scroll-margin-top: 12px; }
.periodbox:focus, .periodbox:focus-visible { outline: none; }
/* Trois tuiles seulement si elles tiennent : sous 480 px, les champs date natifs (largeur minimale ~150 px) sont
   rognés à trois colonnes. On passe à deux colonnes, l'annee prend la ligne entiere. */
.picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 480px) {
  .picks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .picks .pick:last-child { grid-column: 1 / -1; }
}
.pick { margin: 0; min-width: 0; }
.pick label { display: grid; gap: 2px; padding: 6px 10px 7px; border-radius: 14px; min-width: 0;
  background: var(--surface); border: 1px solid rgba(228, 218, 209, .9); cursor: pointer; }
.pick.is-on label { background: var(--ink); border-color: var(--ink); box-shadow: 0 4px 12px rgba(21, 18, 16, .22); }
.pick__l { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.pick.is-on .pick__l { color: rgba(255, 255, 255, .7); }
.pick__in { width: 100%; min-width: 0; min-height: 26px; padding: 0; border: 0; background: transparent;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); -webkit-appearance: none; appearance: none; }
.pick.is-on .pick__in { color: #fff; color-scheme: dark; }
.pick__in:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.pick__in::-webkit-date-and-time-value { text-align: left; }
.pick__go { margin-top: 4px; min-height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-solid, #fff); font: inherit; font-size: 12px; font-weight: 700; }
.periods__note { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); text-align: center; }

.vt { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px;
  background: var(--surface); border: 1px solid rgba(228, 218, 209, .9); border-radius: 18px; }
.vt__i { display: grid; gap: 1px; justify-items: center; padding: 8px 10px; border-radius: 14px; text-decoration: none;
  color: var(--muted); transition: background .2s, color .2s; min-height: 44px; align-content: center; }
.vt__i b { font-size: 15px; font-weight: 700; }
.vt__i span { font-size: 11.5px; font-weight: 600; }
.vt__i:hover { color: var(--ink); }
.vt__i:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.vt__i[aria-current="true"] { background: var(--ink); color: #fff; box-shadow: 0 4px 12px rgba(21, 18, 16, .22); }
.vt__i[aria-current="true"] span { color: rgba(255, 255, 255, .72); }

.stat__s { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.stat--ok .stat__v { color: #24532E; }
.stat--progress { background: #FFF5EB; border-color: #F5D3AE; }
.stat--progress .stat__v { color: #A04E0C; }
.stat--progress .stat__s { color: #A04E0C; font-weight: 600; }

.pill--progress { background: #FFF1E3; color: #9A4A07; }
.pill--progress::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%;
  background: #E8801F; box-shadow: 0 0 0 3px rgba(232, 128, 31, .2); vertical-align: 1px; }

/* Tablette seulement : les trois tuiles de dates sont centrees sous les periodes. Au-dela de 1024 px, la regle
   « pleine largeur » (860 px, alignee a gauche) prend le relais — elle est ecrite plus haut dans le fichier, donc
   sans cette borne elle serait ecrasee par celle-ci. */
@media (min-width: 720px) and (max-width: 1023px) {
  .picks { max-width: 560px; margin-inline: auto; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .vt__i { transition: none; }
}

/* ---------- Tes liens (tunnel complet + page de paiement seule) ---------- */
.mylink + .mylink { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.mylink__title { font-weight: 700; color: var(--ink); font-size: 15px; }
.mylink__tag {
  display: inline-block; margin-left: 6px; padding: 2px 9px; vertical-align: 1px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--gold-text, #7A5A2B); background: #F5EBD6; border-radius: 999px;
}
.mylink .muted { margin-top: 8px; }
.card--link > .muted:last-child { margin-top: 16px; }
