/* ═══════════════════════════════════════════════════════════════
   ALCHIBID — Espace client (démo) · portal.css
   Complète main.css. Toutes les classes sont préfixées « pt- ».
   Mobile-first : cartes empilées sur mobile, tableau ≥ 900 px.
   ═══════════════════════════════════════════════════════════════ */

/* ── Coquille de page ─────────────────────────────────────────── */
.pt-shell {
  position: relative;
  padding: calc(var(--header-h) + clamp(1.8rem, 5vw, 3.2rem)) 0 clamp(3rem, 7vw, 5rem);
  overflow: hidden;
}

/* ── Bandeau démo ─────────────────────────────────────────────── */
.pt-demo {
  display: flex; flex-direction: column; align-items: flex-start; gap: .85rem;
  background: var(--grad-soft);
  border: 1px solid rgba(139, 92, 246, .16);
  border-radius: var(--r-md);
  padding: .95rem 1.15rem;
  margin-bottom: clamp(1.6rem, 4vw, 2.4rem);
  box-shadow: var(--sh-violet);
}
.pt-demo p { margin: 0; font-size: .92rem; color: var(--ink); font-weight: 500; }
.pt-demo .glyph { color: var(--violet-deep); margin-right: .3rem; }
.pt-demo .btn { flex-shrink: 0; }

/* ── En-tête client ───────────────────────────────────────────── */
.pt-head { margin-bottom: clamp(1.4rem, 3.5vw, 2rem); }
.pt-head h1 { font-size: clamp(1.85rem, 5vw, 2.7rem); margin-bottom: .3em; }
.pt-plan { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin: 0; color: var(--body); font-size: .98rem; }
.pt-plan strong { color: var(--ink); }
.pt-plan-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-family: var(--display); font-weight: 600; font-size: .74rem;
  letter-spacing: .08em; text-transform: uppercase;
  background: var(--violet-pale); color: var(--violet-deep);
  padding: .3rem .75rem; border-radius: var(--r-pill);
}

/* ── Cartes KPI ───────────────────────────────────────────────── */
.pt-kpis {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem;
  margin-bottom: clamp(1.6rem, 4vw, 2.2rem);
}
.pt-kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 1.1rem 1.15rem 1rem;
  box-shadow: var(--sh-violet);
  transition: transform .28s cubic-bezier(.2, .7, .2, 1), box-shadow .28s ease, border-color .28s ease;
}
.pt-kpi:nth-child(2) { box-shadow: var(--sh-blue); }
.pt-kpi:nth-child(3) { box-shadow: var(--sh-green); }
.pt-kpi:nth-child(4) { box-shadow: var(--sh-blue); }
.pt-kpi:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 92, 246, .28);
  box-shadow: 0 32px 80px -18px rgba(139, 92, 246, .22), 0 3px 12px rgba(43, 37, 69, .05);
}
.pt-kpi-num { display: block; font-size: clamp(1.7rem, 4.5vw, 2.3rem); line-height: 1.1; color: var(--ink); margin-bottom: .25rem; }
.pt-kpi-label { display: block; font-size: .85rem; color: var(--body); font-weight: 500; line-height: 1.35; }
.pt-kpi-sub { display: block; font-size: .76rem; color: var(--muted); margin-top: .2rem; }

/* ── Grille principale : dossiers + colonne latérale ──────────── */
.pt-layout { display: grid; grid-template-columns: 1fr; gap: 1.2rem; align-items: start; }
.pt-side { display: grid; grid-template-columns: 1fr; gap: 1.2rem; }

/* ── Carte générique ──────────────────────────────────────────── */
.pt-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: clamp(1.2rem, 3vw, 1.6rem);
  box-shadow: var(--sh-violet);
}
.pt-side .pt-card:nth-child(1) { box-shadow: var(--sh-blue); }
.pt-side .pt-card:nth-child(2) { box-shadow: var(--sh-violet); }
.pt-side .pt-card:nth-child(3) { box-shadow: var(--sh-green); }
.pt-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pt-card-head h2 { font-size: 1.18rem; margin: 0; }
.pt-count { font-size: .8rem; color: var(--muted); white-space: nowrap; }

/* ── Barre d'outils : pills de filtre + recherche ─────────────── */
.pt-toolbar { display: flex; flex-direction: column; gap: .85rem; margin: 1.05rem 0 1.15rem; }
.pt-pills { display: flex; flex-wrap: wrap; gap: .45rem; }
.pt-pill {
  font-family: var(--display); font-weight: 600; font-size: .79rem;
  padding: .4rem .8rem; border-radius: var(--r-pill);
  background: #fff; color: var(--body);
  border: 1.5px solid var(--line); cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease, color .2s ease;
}
.pt-pill:hover { transform: translateY(-1px); border-color: var(--violet-soft); color: var(--violet-deep); }
.pt-pill.is-active { background: var(--violet-pale); border-color: var(--violet-soft); color: var(--violet-deep); }
.pt-search { position: relative; }
.pt-search svg {
  position: absolute; left: .95rem; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted); pointer-events: none;
}
.pt-search input {
  width: 100%; font: inherit; font-size: .93rem; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-pill);
  padding: .62rem 1.1rem .62rem 2.6rem;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.pt-search input::placeholder { color: #B5B0C9; }
.pt-search input:focus {
  outline: none; border-color: var(--violet-soft);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, .12);
}

/* ── Tableau des dossiers — cartes empilées sur mobile ────────── */
.pt-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
.pt-table thead { display: none; }
.pt-table tbody { display: grid; grid-template-columns: 1fr; gap: .85rem; }
.pt-table tbody tr {
  display: block;
  background: var(--bg-tint); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 1rem 1.1rem .8rem;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.pt-table tbody tr:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 92, 246, .28);
  box-shadow: 0 18px 44px -16px rgba(139, 92, 246, .18);
}
.pt-table tbody tr[hidden] { display: none; }
.pt-table td {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .34rem 0; border: none;
}
.pt-table td::before {
  content: attr(data-label);
  font-family: var(--display); font-weight: 600; font-size: .68rem;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); flex-shrink: 0;
}
.pt-table td.pt-td-market { display: block; padding: 0 0 .55rem; margin-bottom: .45rem; border-bottom: 1px dashed var(--line); }
.pt-td-market::before { display: none; }
.pt-market { display: block; font-family: var(--display); font-weight: 600; color: var(--ink); font-size: .98rem; line-height: 1.35; }
.pt-buyer { color: var(--body); }
.pt-amount { color: var(--ink); font-size: .93rem; }
.pt-date-cell { color: var(--body); }
.pt-days { display: inline-block; margin-left: .45rem; font-family: var(--mono); font-weight: 600; font-size: .72rem; color: var(--violet-deep); background: var(--violet-pale); padding: .12rem .5rem; border-radius: var(--r-pill); }
.pt-days:empty { display: none; }
.pt-wait { display: inline-block; margin-left: .45rem; font-size: .74rem; color: var(--muted); }

/* Fit Score : barre pastel (réutilise .bar/.bar-* de main.css) */
.pt-fit { display: flex; align-items: center; gap: .6rem; width: 58%; max-width: 220px; }
.pt-fit .bar { flex: 1; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.pt-fit-val { font-size: .8rem; color: var(--ink); min-width: 2.6rem; text-align: right; }

/* Badges de statut */
.pt-badge {
  display: inline-flex; align-items: center; gap: .42rem;
  font-family: var(--display); font-weight: 600; font-size: .76rem;
  padding: .3rem .75rem; border-radius: var(--r-pill); white-space: nowrap;
}
.pt-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .75; }
.pt-b-detecte { background: var(--violet-pale); color: var(--violet-deep); }
.pt-b-go { background: var(--blue-pale); color: #0B7CB8; }
.pt-b-construction { background: var(--violet); color: #fff; }
.pt-b-depose { background: var(--blue); color: #fff; }
.pt-b-gagne { background: var(--green); color: #fff; }
.pt-b-perdu { background: #FFE4E9; color: #BE1237; }
.pt-b-nogo { background: #F7F6FE; color: var(--muted); border: 1px solid var(--line); }

/* Boutons de tri (visibles dans l'en-tête du tableau, desktop) */
.pt-sort {
  display: inline-flex; align-items: center; gap: .3rem;
  font: inherit; font-family: var(--display); font-weight: 600; font-size: .85rem;
  color: var(--ink); background: none; border: none; padding: 0; cursor: pointer;
  transition: color .2s ease;
}
.pt-sort:hover { color: var(--violet-deep); }
.pt-sort-ic { font-size: .8rem; color: var(--violet); }

/* État vide */
.pt-empty { text-align: center; color: var(--muted); font-size: .95rem; padding: 1.5rem 0 .5rem; margin: 0; }

/* ── Prochaines échéances ─────────────────────────────────────── */
.pt-deadlines { display: grid; grid-template-columns: 1fr; gap: .7rem; margin-top: 1.05rem; }
.pt-deadline {
  display: flex; align-items: center; gap: .9rem;
  background: var(--bg-tint); border: 1px solid transparent; border-radius: var(--r-md);
  padding: .72rem .85rem;
  transition: transform .25s ease, border-color .25s ease;
}
.pt-deadline:hover { transform: translateX(3px); border-color: var(--violet-soft); }
.pt-cal {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 52px; height: 52px; flex-shrink: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 8px 20px -10px rgba(139, 92, 246, .2);
}
.pt-cal b { font-family: var(--mono); font-weight: 600; font-size: 1.12rem; color: var(--ink); line-height: 1.1; }
.pt-cal span { font-family: var(--display); font-weight: 600; font-size: .58rem; letter-spacing: .1em; text-transform: uppercase; color: var(--violet-deep); }
.pt-deadline-body { min-width: 0; }
.pt-deadline-title { display: block; font-weight: 600; color: var(--ink); font-size: .9rem; line-height: 1.35; }
.pt-deadline-sub { display: block; font-size: .8rem; color: var(--muted); }

/* ── Dernière analyse de résultat (Bid Intelligence) ──────────── */
.pt-intel-tag {
  display: inline-block; font-family: var(--display); font-weight: 600; font-size: .66rem;
  letter-spacing: .13em; text-transform: uppercase;
  background: var(--blue-pale); color: #0B7CB8;
  padding: .3rem .7rem; border-radius: var(--r-pill); margin-bottom: .7rem;
}
.pt-intel-market { font-weight: 600; color: var(--ink); font-size: .95rem; margin: .9rem 0 .8rem; }
.pt-intel-rows { display: grid; grid-template-columns: 1fr; gap: 0; }
.pt-intel-rows li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: .55rem 0; border-bottom: 1px dashed var(--line); font-size: .88rem;
}
.pt-intel-rows li span { color: var(--body); }
.pt-intel-rows li strong { color: var(--ink); font-size: .95rem; white-space: nowrap; }
.pt-intel-lesson {
  margin: 1rem 0 0; padding: .85rem 1rem;
  background: var(--violet-pale); border-left: 4px solid var(--violet);
  border-radius: var(--r-sm);
  font-size: .88rem; color: var(--ink); font-weight: 500;
}
.pt-intel-lesson b { font-family: var(--display); display: block; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--violet-deep); margin-bottom: .25rem; }

/* ── Vault documentaire ───────────────────────────────────────── */
.pt-vault-stats { display: flex; align-items: baseline; gap: 1.4rem; margin: .9rem 0 .7rem; }
.pt-vault-stats .pt-kpi-num { font-size: 1.65rem; margin-bottom: .1rem; }
.pt-vault-bar { margin-bottom: 1rem; }
.pt-docs { display: grid; grid-template-columns: 1fr; gap: .45rem; }
.pt-doc {
  display: flex; align-items: center; gap: .6rem;
  background: var(--bg-tint); border-radius: var(--r-sm);
  padding: .55rem .8rem; font-size: .87rem; color: var(--ink); font-weight: 500;
}
.pt-doc small { margin-left: auto; color: var(--muted); font-weight: 400; white-space: nowrap; }
.pt-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.pt-dot-ok { background: var(--green); box-shadow: 0 0 0 4px rgba(16, 185, 129, .14); }
.pt-dot-warn { background: var(--rose); box-shadow: 0 0 0 4px rgba(244, 63, 94, .14); }
.pt-vault-note { font-size: .8rem; color: var(--muted); margin: .8rem 0 0; }

/* ── CTA final ────────────────────────────────────────────────── */
.pt-cta {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1rem;
  background: var(--grad-soft); border-radius: var(--r-lg);
  padding: clamp(1.4rem, 3.5vw, 2rem) clamp(1.3rem, 3.5vw, 2.2rem);
  box-shadow: var(--sh-violet-lg);
  margin-top: clamp(1.8rem, 4vw, 2.6rem);
}
.pt-cta h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); margin-bottom: .3em; }
.pt-cta p { margin: 0; font-size: .95rem; max-width: 40em; }
.pt-cta .btn { flex-shrink: 0; }

/* ═══ ≥ 680px ═════════════════════════════════════════════════── */
@media (min-width: 680px) {
  .pt-demo { flex-direction: row; align-items: center; justify-content: space-between; }
  .pt-kpis { grid-template-columns: repeat(4, 1fr); gap: 1rem; }
  .pt-cta { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
}

/* ═══ ≥ 900px — le tableau redevient un vrai tableau ═════════── */
@media (min-width: 900px) {
  .pt-toolbar { flex-direction: row; align-items: center; justify-content: space-between; }
  .pt-search { width: min(320px, 100%); flex-shrink: 0; }

  .pt-table { min-width: 660px; }
  .pt-table thead { display: table-header-group; }
  .pt-table tbody { display: table-row-group; }
  .pt-table tbody tr { display: table-row; background: transparent; border: none; padding: 0; }
  .pt-table tbody tr:hover { transform: none; box-shadow: none; }
  .pt-table tbody tr:hover td { background: var(--bg-tint); }
  .pt-table th, .pt-table td { display: table-cell; padding: .7rem .55rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
  .pt-table thead th {
    font-family: var(--display); font-weight: 600; font-size: .85rem; color: var(--ink);
    background: var(--bg-tint); text-align: left; white-space: nowrap;
  }
  .pt-table thead th:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
  .pt-table thead th:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
  .pt-table tbody tr:last-child td { border-bottom: none; }
  .pt-table td::before { display: none; }
  .pt-table td { justify-content: flex-start; }
  .pt-table td.pt-td-market { display: table-cell; padding: .7rem .55rem; margin: 0; border-bottom: 1px solid var(--line); }
  .pt-table tbody tr:last-child .pt-td-market { border-bottom: none; }
  .pt-market { font-size: .92rem; max-width: 24em; }
  .pt-fit { width: 110px; max-width: none; }
  .pt-fit-val { min-width: 2.4rem; }
  /* Sous-libellés de deadline empilés sous la date (gain de largeur) */
  .pt-days, .pt-wait { display: block; margin: .18rem 0 0; width: fit-content; }
  .pt-days:empty { display: none; }
}

/* ═══ ≥ 1160px — colonne latérale ═════════════════════════════── */
/* (breakpoint aligné sur --maxw : en dessous, la carte « dossiers »
   serait trop étroite pour le tableau sans scroll horizontal) */
@media (min-width: 1160px) {
  .pt-layout { grid-template-columns: minmax(0, 1.85fr) minmax(300px, 1fr); }

  /* La colonne latérale réduit la carte « dossiers » : le tableau
     doit tenir dans sa carte sans scroll horizontal. */
  .pt-table { min-width: 0; width: 100%; }
  .pt-table th, .pt-table td, .pt-table td.pt-td-market { padding: .7rem .4rem; }
  .pt-table thead th { white-space: normal; }
  .pt-table thead th .pt-sort { text-align: left; }
  .pt-table tbody .pt-badge { font-size: .72rem; padding: .26rem .6rem; }
  .pt-market { max-width: none; }
  .pt-buyer { font-size: .82rem; color: var(--muted); }
  .pt-fit { width: 88px; }
}

/* ── Mouvement réduit ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .pt-kpi, .pt-pill, .pt-table tbody tr, .pt-deadline, .pt-sort { transition: none; }
}
