/* Espace client — design system. Mobile-first, référence 280px.
 * S'appuie sur tokens.css (variables --wc-*). Aucun style collabo ici.
 */
.client-wrap { max-width: 640px; margin: 0 auto; }

/* ————— Hero ————— */
.client-hero {
  background: var(--wc-gradient);
  color: #fff;
  border-radius: 20px;
  padding: 1.25rem 1.1rem;
  box-shadow: var(--wc-shadow-md);
  position: relative;
  overflow: hidden;
}
.client-hero::after {
  content: '';
  position: absolute;
  right: -48px; top: -48px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,.10);
}
.client-hero::before {
  content: '';
  position: absolute;
  right: 24px; bottom: -70px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
}
.client-hero h1 { position: relative; z-index: 1; }
.client-hero p { position: relative; z-index: 1; }
.client-hero-icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.16);
  font-size: 1.5rem;
  position: relative; z-index: 1;
}

/* ————— Cartes demande ————— */
.demand-card { transition: transform .15s ease, box-shadow .15s ease; }
.demand-card:hover { transform: translateY(-2px); box-shadow: var(--wc-shadow-md); }
@media (hover: none) { .demand-card:active { transform: scale(.99); } }
.demand-top { display: flex; align-items: flex-start; gap: .75rem; }
.demand-avatar {
  flex: none;
  width: 46px; height: 46px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(16,54,91,.12), rgba(30,64,175,.12));
  color: var(--wc-primary);
  font-size: 1.3rem;
}
.demand-ref {
  color: var(--wc-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.demand-ref i { color: var(--wc-primary); opacity: .7; }

/* ————— Pills statut ————— */
.wc-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; font-weight: 600;
  padding: .22rem .65rem;
  border-radius: 999px;
  white-space: nowrap;
}
.wc-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-info { background: rgba(30,64,175,.10); color: #1e40af; }
.pill-progress { background: rgba(2,132,199,.12); color: #0369a1; }
.pill-success { background: rgba(22,163,74,.12); color: #15803d; }
.pill-warn { background: rgba(217,119,6,.14); color: #b45309; }
.pill-danger { background: rgba(220,38,38,.10); color: #b91c1c; }
.pill-neutral { background: rgba(100,116,139,.14); color: #475569; }

/* ————— Stepper suivi ————— */
.steps { display: flex; margin: .9rem 0 .25rem; padding: 0; list-style: none; }
.steps li { flex: 1 1 0; text-align: center; position: relative; min-width: 0; }
.steps li::before {
  content: '';
  position: absolute; top: 13px; left: -50%;
  width: 100%; height: 2px;
  background: #e2e8f0;
}
.steps li:first-child::before { display: none; }
.steps li.done::before { background: #16a34a; }
.steps .dot {
  position: relative; z-index: 1;
  width: 28px; height: 28px; margin: 0 auto 4px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #e2e8f0; color: #94a3b8;
  font-size: .8rem;
}
.steps li.done .dot { background: #16a34a; color: #fff; }
.steps li.now .dot {
  background: var(--wc-primary); color: #fff;
  box-shadow: 0 0 0 4px rgba(16,54,91,.15);
}
.steps li.now::before { background: #16a34a; }
.steps .lbl { font-size: .66rem; font-weight: 600; color: var(--wc-muted); line-height: 1.25; display: block; }
.steps li.now .lbl { color: var(--wc-primary); }

/* ————— Montant estimation ————— */
.amount-big {
  font-size: clamp(1.6rem, 7vw, 2.1rem);
  font-weight: 700;
  color: var(--wc-primary);
  letter-spacing: -.02em;
}

/* ————— Code à 4 chiffres (login) ————— */
.code-input {
  text-align: center;
  font-size: 1.6rem !important;
  font-weight: 700;
  letter-spacing: .5rem !important;
  text-indent: .5rem;
  font-variant-numeric: tabular-nums;
}
.trust-row {
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  font-size: .78rem; color: var(--wc-muted);
  margin-top: .9rem;
}

/* ————— Timeline rail ————— */
#client-timeline { position: relative; }
#client-timeline li { position: relative; padding-left: 1.9rem !important; }
#client-timeline li::before {
  content: '';
  position: absolute; left: .62rem; top: 1rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--wc-primary);
  box-shadow: 0 0 0 3px rgba(16,54,91,.12);
}
#client-timeline li::after {
  content: '';
  position: absolute; left: calc(.62rem + 4px); top: 1.7rem; bottom: -.6rem;
  width: 2px; background: #e2e8f0;
}
#client-timeline li:last-child::after { display: none; }
#client-timeline li.tl-you::before { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.15); }

/* ————— Skeleton ————— */
.skel {
  border-radius: var(--wc-radius-lg);
  background: linear-gradient(90deg, #eef2f7 25%, #e2e8f0 50%, #eef2f7 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.2s infinite;
}
@keyframes skel-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ————— Divers ————— */
.section-title { display: flex; align-items: center; gap: .5rem; }
.section-title i { color: var(--wc-primary); }
.empty-state {
  text-align: center; padding: 1.25rem .75rem;
  color: var(--wc-muted); font-size: .88rem;
}
.empty-state i { display: block; font-size: 1.8rem; margin-bottom: .35rem; opacity: .5; }
.decision-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.decision-row .btn { flex: 1 1 0; min-height: 44px; font-weight: 600; }

/* ————— Très petits écrans : 280px ————— */
@media (max-width: 320px) {
  .client-hero { padding: 1rem .85rem; border-radius: 16px; }
  .client-hero-icon { width: 44px; height: 44px; font-size: 1.25rem; }
  .steps .lbl, .pipe .plab { font-size: .8rem; }
  .code-input { font-size: 1.35rem !important; letter-spacing: .35rem !important; }
  .decision-row .btn { font-size: .82rem; padding-left: .4rem; padding-right: .4rem; }
  .cal-day { min-height: 36px; font-size: .78rem; border-radius: 10px; }
  .chip { min-height: 38px; padding: .35rem .6rem; font-size: .78rem; }
}

/* ————— Accordéons (progressive disclosure) ————— */
.acc { border-radius: var(--wc-radius-lg); overflow: hidden; }
.acc-head {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  min-height: 52px; padding: .7rem 1rem;
  background: var(--wc-surface); color: var(--wc-text);
  border: 1px solid rgba(16,54,91,.12); border-radius: var(--wc-radius-lg);
  font-weight: 600; font-size: .95rem; text-align: left;
  box-shadow: var(--wc-shadow-sm);
}
.acc-head > span > i { color: var(--wc-primary); }
.acc-chev { transition: transform .2s ease; color: var(--wc-muted); flex: none; }
.acc-head[aria-expanded="true"] { border-radius: var(--wc-radius-lg) var(--wc-radius-lg) 0 0; border-bottom: none; }
.acc-head[aria-expanded="true"] .acc-chev { transform: rotate(180deg); }
.acc-body {
  background: var(--wc-surface);
  border: 1px solid rgba(16,54,91,.12); border-top: none;
  border-radius: 0 0 var(--wc-radius-lg) var(--wc-radius-lg);
  padding: 0 1rem 1rem;
}
.acc-body[hidden] { display: none; }
.acc-action-dot {
  flex: none; width: 9px; height: 9px; border-radius: 50%;
  background: #dc2626;
  animation: skel-shimmer 1.6s infinite;
}

/* ————— Roadmap verticale ————— */
.pipe { list-style: none; padding: 0; margin: .25rem 0 0; display: grid; }
.pipe li { position: relative; padding: 0 0 .85rem 2rem; }
.pipe li:last-child { padding-bottom: 0; }
.pipe li::before {
  content: '';
  position: absolute; left: .55rem; top: 1.5rem; bottom: -.15rem;
  width: 2px; background: #e2e8f0;
}
.pipe li:last-child::before { display: none; }
.pipe .pdot {
  position: absolute; left: 0; top: .15rem;
  width: 1.25rem; height: 1.25rem; border-radius: 50%;
  display: grid; place-items: center;
  background: #e2e8f0; color: #94a3b8; font-size: .7rem;
}
.pipe li.done .pdot { background: #16a34a; color: #fff; }
.pipe li.now .pdot {
  background: var(--wc-primary); color: #fff;
  box-shadow: 0 0 0 4px rgba(16,54,91,.15);
}
.pipe li.done::before { background: #16a34a; }
.pipe .plab { font-weight: 600; font-size: .9rem; }
.pipe li.todo .plab { color: var(--wc-muted); font-weight: 500; }
.pipe .phint { font-size: .76rem; color: var(--wc-muted); margin-left: .45rem; }
.pipe li.now .phint { color: var(--wc-primary); }
/* Étapes à venir : grisées (purement visuel, le <li> n'est pas un contrôle). */
.pipe li.todo { opacity: .5; }
/* Aperçu de la valeur (montant/date) + note d'état */
.pipe .pvalue {
  margin: .1rem 0 0; font-size: .82rem; font-weight: 600; line-height: 1.35;
  color: var(--wc-text);
}
.pipe .pvalue .pnote { font-weight: 500; color: var(--wc-muted); }
.pipe .pvalue.pv-success { color: #15803d; }
.pipe .pvalue.pv-danger { color: #b91c1c; }
.pipe .pvalue.pv-warn { color: #b45309; }
.pipe .pvalue.pv-info, .pipe .pvalue.pv-progress { color: var(--wc-primary); }
/* Lien d'accès à la rubrique (ou au devis imprimable) */
.pipe .popen {
  display: inline-flex; align-items: center; gap: .3rem;
  margin-top: .35rem; min-height: 34px; padding: .25rem .6rem;
  border: 1px solid rgba(16,54,91,.25); border-radius: 999px;
  background: var(--wc-surface); color: var(--wc-primary);
  font-size: .78rem; font-weight: 600; text-decoration: none;
}
.pipe .popen:hover { background: rgba(16,54,91,.06); }
/* Actions rapides (icônes seules : 44 px, aria-label + info-bulle) */
.pipe .pacts { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.pipe .pact {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid rgba(16,54,91,.2); background: var(--wc-surface);
  color: var(--wc-primary); font-size: 1.05rem;
}
.pipe .pact:hover { background: rgba(16,54,91,.07); }
.pipe .pact:active { transform: scale(.94); }

/* ————— Calendrier disponibilités ————— */
.cal { user-select: none; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.cal-head strong { font-size: .95rem; text-transform: capitalize; }
.cal-nav {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid rgba(16,54,91,.15); background: var(--wc-surface); color: var(--wc-primary);
  display: grid; place-items: center;
}
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow span { text-align: center; font-size: .7rem; font-weight: 600; color: var(--wc-muted); padding: .2rem 0; }
.cal-day {
  min-height: 40px; border-radius: 12px;
  border: 1px solid transparent; background: rgba(16,54,91,.05);
  font-size: .85rem; font-weight: 600; color: var(--wc-text);
  display: grid; place-items: center;
}
.cal-day:disabled { opacity: .32; background: transparent; }
.cal-day.today { border-color: var(--wc-primary); }
.cal-day.picked { background: var(--wc-primary); color: #fff; }
.cal-blank { visibility: hidden; }
/* ————— Chips horaires + urgence ————— */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  min-height: 40px; padding: .4rem .8rem;
  border-radius: 999px; font-size: .85rem; font-weight: 600;
  border: 1.5px solid rgba(16,54,91,.25); background: var(--wc-surface); color: var(--wc-primary);
}
.chip[aria-pressed="true"] { background: var(--wc-primary); border-color: var(--wc-primary); color: #fff; }
.seg { display: flex; gap: .4rem; }
.seg .chip { flex: 1 1 0; box-shadow: var(--wc-shadow-sm); }
.seg .chip[data-v="normal"][aria-pressed="true"] { background: #16a34a; border-color: #16a34a; color: #fff; box-shadow: 0 4px 14px rgba(22,163,74,.45); }
.seg .chip[data-v="urgent"][aria-pressed="true"] { background: #d97706; border-color: #d97706; box-shadow: 0 4px 14px rgba(217,119,6,.45); }
.seg .chip[data-v="emergency"][aria-pressed="true"] { background: #dc2626; border-color: #dc2626; box-shadow: 0 4px 14px rgba(220,38,38,.5); }

/* ————— Signature dessinée ————— */
.sign-pad {
  width: 100%; height: 140px;
  border: 1.5px dashed rgba(16,54,91,.4); border-radius: var(--wc-radius);
  background: #fff; touch-action: none; cursor: crosshair;
}
/* ————— Chat dossier ————— */
.msg-bubble {
  max-width: 88%;
  padding: .5rem .8rem;
  border-radius: 14px;
  font-size: .88rem;
}
.msg-me { justify-self: end; background: var(--wc-gradient); color: #fff; border-bottom-right-radius: 4px; }
.msg-them { justify-self: start; background: #eef2f7; color: var(--wc-text); border-bottom-left-radius: 4px; }
.msg-meta { opacity: .7; font-size: .7rem; margin-top: .2rem; }
.msg-read { font-weight: 700; opacity: .8; }
.msg-read.seen { color: #53bdeb; opacity: 1; }
.msg-me .msg-read.seen { color: #d6f0ff; }
.msg-sending { opacity: .65; }
#client-messages { justify-items: stretch; }

/* ————— Cloche de notification (suivi) ————— */
.client-bell {
  position: relative; flex: none;
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.16); color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  font-size: 1.2rem; z-index: 1;
}
.client-bell-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px;
  background: #dc2626; color: #fff;
  font-size: .7rem; font-weight: 700;
  display: grid; place-items: center;
}
.notif-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; max-height: 300px; overflow-y: auto; }
.notif-list li { padding: .55rem .8rem; }
.notif-list .notif-new { border: 1.5px solid var(--wc-primary); }

/* ————— Effets sobres (sections, accordéons, nouveautés) ————— */
.client-hero { animation: hero-in .35s ease; }
@keyframes hero-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.demand-card { animation: card-in .3s ease backwards; }
#client-demands > li:nth-child(2) .demand-card { animation-delay: .05s; }
#client-demands > li:nth-child(3) .demand-card { animation-delay: .1s; }
#client-demands > li:nth-child(4) .demand-card { animation-delay: .15s; }
#client-demands > li:nth-child(n+5) .demand-card { animation-delay: .2s; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.acc-body:not([hidden]) { animation: acc-in .22s ease; }
@keyframes acc-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
/* Pastille clignotante : message non lu (éteinte sous prefers-reduced-motion). */
#badge-msg.has-unread { animation: msg-blink 1.2s ease-in-out infinite; }
@keyframes msg-blink {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.4); }
}
/* Flash bref quand le détail vient d'être mis à jour en silence. */
#client-detail-wrap.has-novelty #client-detail { animation: novelty-flash 1.6s ease; }
@keyframes novelty-flash {
  0% { box-shadow: 0 0 0 3px rgba(16,54,91,.35); }
  100% { box-shadow: none; }
}

/* ————— PC : cartes aérées (le wrap 640px + 3 colonnes écrasait tout) ————— */
@media (min-width: 760px) {
  .client-wrap { max-width: 920px; }
  #client-demands.wc-grid-cards { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .demand-card { font-size: 1rem; }
  .demand-card .h6 { font-size: 1.05rem; }
  .demand-avatar { width: 54px; height: 54px; font-size: 1.5rem; }
  #client-detail-wrap { max-width: 760px; }
}

/* ————— Feedback tactile : tout ce qui est cliquable réagit ————— */
button, .btn, a.btn, .acc-head, .chip, .cal-day, .cal-nav,
.client-bell, summary, .demand-card {
  transition: transform .12s ease, box-shadow .15s ease, filter .15s ease, background-color .15s ease, border-color .15s ease;
}
summary { cursor: pointer; }
:focus-visible { outline: 2px solid var(--wc-primary); outline-offset: 2px; }
@media (hover: hover) {
  .wc-btn-primary:hover, .btn-primary:hover { filter: brightness(1.08); box-shadow: var(--wc-shadow-md); }
  .wc-btn-ghost:hover, .btn-outline-secondary:hover, .btn-outline-primary:hover { border-color: var(--wc-primary); color: var(--wc-primary); }
  .btn-success:hover { filter: brightness(1.07); box-shadow: var(--wc-shadow-md); }
  .btn-outline-danger:hover { box-shadow: var(--wc-shadow-sm); }
  .acc-head:hover { border-color: var(--wc-primary); background: rgba(16,54,91,.04); }
  .chip:hover:not([aria-pressed="true"]), .seg .chip:hover:not([aria-pressed="true"]) { border-color: var(--wc-primary); }
  .cal-day:hover:not(:disabled):not(.picked) { border-color: var(--wc-primary); }
  .cal-nav:hover { border-color: var(--wc-primary); color: var(--wc-primary); }
  .client-bell:hover { background: rgba(255,255,255,.28); }
  #client-refresh:hover i { transform: rotate(40deg); }
  #client-refresh i { display: inline-block; transition: transform .2s ease; }
  a[href^="tel:"]:hover, a[href^="mailto:"]:hover { filter: brightness(1.07); }
  #client-notif-list li:hover { border-color: rgba(16,54,91,.3); }
}
button:active, .btn:active, a.btn:active, .acc-head:active,
.chip:active, .cal-day:active:not(:disabled), .cal-nav:active,
.client-bell:active, .demand-card:active {
  transform: scale(.97);
}

/* ————— Mouvements réduits ————— */
@media (prefers-reduced-motion: reduce) {
  .skel, .acc-action-dot { animation: none; }
  .demand-card, .demand-card:hover { transform: none; }
  .acc-chev { transition: none; }
  .client-hero, .demand-card, .acc-body:not([hidden]) { animation: none; }
  #badge-msg.has-unread { animation: none; }
  #client-detail-wrap.has-novelty #client-detail { animation: none; }
  button, .btn, a.btn, .acc-head, .chip, .cal-day, .cal-nav,
  .client-bell, summary, .demand-card { transition: none; }
  button:active, .btn:active, a.btn:active, .acc-head:active,
  .chip:active, .cal-day:active:not(:disabled), .cal-nav:active,
  .client-bell:active, .demand-card:active { transform: none; }
}
