/* Right drawer — accent = couleur numérologie. Tokens → tokens.css
   #1153 lot 1 : --pd-accent-soft / --pd-glow → tokens.css */

.pd-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  pointer-events: none;
}

.pd-overlay:not([hidden]) {
  pointer-events: auto;
}

.pd-overlay[hidden] {
  display: none !important;
}

.pd-scrim {
  position: absolute;
  inset: 0;
  /* CC-POPIN-SCRIM-BLUR-01 (#563) : flou partagé avec les popins (--popin-*)
     — le fond est flouté, plus assombri ; source unique */
  /* CU-POPIN-NOSCRIM-01 (#470) : scrim transparent, clic dehors conserve close */
  background: var(--popin-scrim, transparent);
  backdrop-filter: var(--popin-scrim-blur, none);
  -webkit-backdrop-filter: var(--popin-scrim-blur, none);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.pd-overlay.is-open .pd-scrim {
  opacity: 1;
}

.pd-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 480px;
  height: 100%;
  background: var(--surface);
  box-shadow: var(--shadow-drawer);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  font-family: var(--pd-font);
  color: var(--pd-fg);
  overflow: hidden;
}

.pd-drawer::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -40px;
  width: 220px;
  height: 220px;
  border-radius: var(--radius-circle);
  background: radial-gradient(circle, var(--pd-glow) 0%, transparent 70%);
  pointer-events: none;
}

.pd-overlay.is-open .pd-drawer {
  transform: translateX(0);
}

/* ── En-tête : onglets + × sur UNE ligne (#767) ── */
.pd-head {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 0 20px;
  border-bottom: 1px solid var(--pd-border);
}

.pd-name {
  margin: 0 0 2px;
  font-size: var(--text-rem-1375);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

/* ── Avatar + identité (onglet Perso)
   CU-DRAWER-POLISH-01 (#767) — diagnostic : `.pd-hero` en `display:flex`
   gardait `align-items: stretch` (initial). Sur un flex item `<img>`, le
   stretch de l’axe croisé imposait une hauteur indépendante de
   `aspect-ratio: 1` / du couple width×height HTML → rectangle malgré #700.
   Correctif : cadre carré `.pd-hero-frame` (UNE dimension → côté), image
   `width/height:100%` + `object-fit:cover` (crop, jamais stretch). */
.pd-hero {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 14px;
}

.pd-hero-frame {
  width: min(180px, 65%);
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: var(--radius-16);
  box-shadow: var(--shadow-overlay);
  background: var(--surface); /* #700 : fond blanc opaque */
}

.pd-hero-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border: 0;
  border-radius: 0;
  background: var(--surface);
}

.pd-name-block {
  margin: 0 0 16px;
  text-align: left;
}

.pd-name-block .pd-name-line {
  display: block;
  margin: 0;
  padding: 0;
  line-height: 1.25;
}

.pd-name-block .pd-name-line + .pd-name-line {
  margin-top: 4px;
}

.pd-name-nick {
  font-size: var(--text-rem-225);
  font-weight: 700;
  font-style: normal;
  color: var(--pd-fg);
}

.pd-name-given {
  font-size: var(--text-rem-225);
  font-weight: 700;
  letter-spacing: 0;
  color: var(--pd-fg);
}

.pd-name-middle,
.pd-name-maiden {
  font-size: var(--text-rem-225);
  font-weight: 700;
  color: var(--pd-fg);
}

.pd-name-surname {
  font-size: var(--text-rem-225);
  font-weight: 700;
  letter-spacing: 0;
  color: var(--pd-fg);
}

.pd-name-locked {
  line-height: 1;
}

.pd-dates {
  margin: 0;
  font-size: var(--text-rem-875);
  font-weight: 700;
  color: var(--pd-accent);
}

.pd-name-dates {
  margin: -8px 0 14px;
  font-size: var(--text-rem-95);
  font-weight: 700;
  color: var(--pd-accent);
  font-variant-numeric: var(--nums-date, tabular-nums);
}

/* #1005 : CTA Éditer (drawer → popin) — crayon Lucide pencil-line */
.pd-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  margin: 0 0 16px;
  padding: 0 18px;
  border-radius: var(--radius-full, 999px);
  border: 1px solid color-mix(in srgb, var(--colo-fresh, #7141D9) 35%, transparent);
  background: color-mix(in srgb, var(--colo-fresh, #7141D9) 8%, var(--surface, #fff));
  color: var(--colo-fresh, #7141D9);
  font: 600 14px/1.2 var(--font, 'Satoshi', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.pd-edit-btn svg { flex-shrink: 0; display: block; }
.pd-edit-btn:hover {
  background: color-mix(in srgb, var(--colo-fresh, #7141D9) 14%, var(--surface, #fff));
  border-color: var(--colo-fresh, #7141D9);
}

/* #971 : apparence via .ui-x (close-button.css) — position seule. */
.pd-close { flex-shrink: 0; align-self: center; }

/* ── Onglets soulignés (dans .pd-head, alignés au ×) ── */
.pd-tabs {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0;
  border-bottom: 0;
}

.pd-tab {
  border: 0;
  background: transparent;
  color: var(--pd-muted);
  font: inherit;
  font-size: var(--text-rem-875);
  font-weight: 600;
  padding: 12px 0;
  margin-bottom: -1px;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: color 0.15s ease;
  line-height: 1.2;
}

.pd-tab.on {
  color: var(--pd-fg);
  font-weight: 800;
  border-bottom-color: var(--pd-accent);
}

.pd-tab:hover:not(.on) {
  color: var(--pd-fg);
}

/* ── Panneaux ── */
.pd-panels {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pd-panel {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 20px 24px;
  -webkit-overflow-scrolling: touch;
}

.pd-panel.on {
  display: block;
}

.pd-placeholder {
  margin: 40px 0;
  text-align: center;
  color: var(--pd-muted);
  font-size: var(--text-rem-9);
}

/* ── Widgets astro — carte unifiée 4 colonnes (maquette Lisa) ── */
.pd-astro-row {
  display: grid;
  grid-template-columns: repeat(var(--pd-astro-cols, 4), minmax(0, 1fr));
  gap: 0;
  width: 100%;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--pd-border);
  border-radius: var(--radius-16);
  box-shadow: var(--shadow-subtle-md);
  overflow: hidden;
}

.pd-astro-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  min-width: 0;
  padding: 10px 4px 8px;
  border: 0;
  border-radius: var(--radius-none);
  background: transparent;
  box-shadow: none;
  text-align: center;
  min-height: 0;
}

.pd-astro-card:not(:last-child) {
  border-right: 1px solid var(--surface-control);
}

.pd-astro-card--ascendant .pd-astro-card-value {
  font-size: var(--text-rem-75);
  font-weight: 700;
  margin: 0 0 4px;
}

.pd-astro-card--ascendant .pd-astro-card-cap {
  margin-top: auto;
}

.pd-astro-card.is-locked {
  background: var(--surface-subtle-8);
  justify-content: center;
}

.pd-astro-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 3.8rem;
  font-size: var(--text-rem-38);
  line-height: 1;
  margin: 0 0 5px;
  flex-shrink: 0;
}

.pd-astro-card-value {
  font-size: var(--text-rem-75);
  font-weight: 700;
  color: var(--pd-fg);
  line-height: 1.2;
  margin: 0 0 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pd-astro-card--lifepath .pd-astro-lifepath-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 3.8rem;
  font-size: var(--text-rem-3);
  font-weight: 400;
  color: var(--pd-accent);
  line-height: 1;
  text-align: center;
  margin: 0 0 5px;
  flex-shrink: 0;
  letter-spacing: 0;
}

.pd-astro-card--lifepath .pd-astro-card-value {
  font-size: var(--text-rem-75);
  font-weight: 700;
  color: var(--pd-fg);
  line-height: 1.2;
  margin: 0 0 4px;
  letter-spacing: 0;
}

.pd-astro-card-cap {
  font-size: var(--text-rem-5625);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pd-muted);
  margin-top: auto;
  line-height: 1.3;
}

.pd-astro-hint {
  font-size: var(--text-rem-5625);
  color: var(--pd-muted);
  font-style: italic;
  width: 100%;
  text-align: center;
}

/* ── Carte détails ── */
.pd-detail-card {
  background: var(--surface);
  border: 1px solid var(--pd-border);
  border-radius: var(--radius-16);
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
  margin-bottom: 12px;
}

.pd-detail-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--surface-subtle-4);
  font-size: var(--text-rem-8125);
}

.pd-detail-row:last-child {
  border-bottom: 0;
}

.pd-detail-label {
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--pd-accent);
  font-size: var(--text-rem-8125);
}

.pd-detail-value {
  flex: 1 1 auto;
  text-align: right;
  color: var(--pd-fg);
  font-weight: 500;
  font-size: var(--text-rem-8125);
  word-break: break-word;
}

.pd-detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

.pd-couple-sep {
  flex-shrink: 0;
  color: var(--pd-muted);
  font-weight: 700;
  font-size: var(--text-rem-75);
  line-height: 1;
  user-select: none;
}

.pd-detail-links--couple {
  flex-wrap: nowrap;
  gap: 4px;
}

/* CU-DRAWER-POLISH-01 (#767) + retour : Connexions — sous-titre au-dessus,
   grille 2 colonnes largeur égale, typo resserrée. */
.pd-fam-section {
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--surface-subtle-4);
}

.pd-fam-section:last-child {
  border-bottom: 0;
}

.pd-fam-section > .pd-fam-subhead {
  margin: 0 0 8px;
  padding: 0;
  text-align: left;
}

.pd-fam-nodes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  align-items: stretch;
}

.pd-fam-node.person-picker-option {
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 36px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-10, 10px);
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  background: var(--surface-control, #f0f2f6);
  border: 1px solid var(--field-border, #d7dbe6);
  font-size: var(--text-2xs, 11px);
}

.pd-fam-node.person-picker-option:hover {
  border-color: color-mix(in srgb, var(--pd-accent) 35%, var(--pd-border));
  background: color-mix(in srgb, var(--pd-accent) 6%, var(--surface));
}

.pd-fam-node .person-picker-avatar,
.pd-fam-node .relation-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-8);
  background: var(--surface);
}

.pd-fam-node .relation-name {
  font-size: var(--text-2xs, 11px);
  font-weight: 600;
  line-height: 1.2;
}

.pd-fam-node .relation-meta {
  font-size: var(--text-xs, 10px);
  line-height: 1.15;
}

.pd-fam-node .person-picker-tag { display: none; }

/* ── Connexions : blocs ancêtres ── */
.pd-fam-ancestry {
  border-top: 1px solid var(--surface-subtle-4);
}

.pd-fam-ancestry .pd-fam-section {
  border-bottom: 1px solid var(--surface-subtle-4);
}

.pd-fam-subhead {
  margin: 0;
  padding: 10px 14px 4px;
  font-size: var(--text-rem-625);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pd-muted);
  text-align: left;
}

.pd-detail-row.is-locked {
  align-items: center;
}

.pd-lock-btn {
  border: 0;
  background: var(--pd-accent-soft);
  color: var(--pd-accent);
  font: inherit;
  font-size: var(--text-rem-78);
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
}

.pd-lock-btn:hover {
  filter: brightness(0.97);
}

/* CC-PREMIUM-HOLO-01 (#818) : le badge holo dans la pilule (aligné au texte),
   et la variante icône SEULE (nom masqué, cartes astro) — ronde, sans fond. */
.pd-lock-btn .ph-badge { vertical-align: -4px; margin-right: 2px; }
.pd-lock-btn--ico {
  padding: 2px;
  background: transparent;
  line-height: 0;
}
.pd-lock-btn--ico .ph-badge { margin-right: 0; }

/* ── Liens famille (même style que détail Perso) ── */
.pd-rel-link {
  border: 0;
  background: var(--pd-accent-soft);
  color: var(--pd-accent);
  font: inherit;
  font-size: var(--text-rem-8125);
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pd-rel-link:hover {
  background: color-mix(in srgb, var(--pd-accent) 18%, var(--surface));
}

.pd-empty {
  color: var(--pd-muted);
  font-size: var(--text-rem-85);
  font-style: italic;
}

.pd-err {
  margin: 24px 0;
  padding: 12px 14px;
  border-radius: var(--radius-12);
  background: var(--surface-error-soft);
  color: var(--color-error-alt);
  font-size: var(--text-rem-88);
}

.pd-loading {
  padding: 48px 0;
  text-align: center;
  color: var(--pd-muted);
  font-size: var(--text-rem-9);
}

@media (max-width: 768px) {
  .pd-drawer {
    width: 100%;
    max-width: none;
  }

  .pd-astro-row {
    grid-template-columns: 1fr 1fr;
  }

  /* ⚠️ #993 — LES FILETS SE DÉDUISENT DE LA GRILLE, ILS NE SE NOMMENT PLUS.
     Ces quatre règles étaient écrites PAR CARTE (zodiaque, chemin de vie,
     chinois, ascendant) : elles supposaient qu'il y en avait exactement
     quatre, sur deux rangées. La LUNE en fait une cinquième, et le dessin
     tombait faux — un filet à droite de la dernière, pas de filet sous
     l'avant-dernière. On décrit donc LA POSITION, pas le nom : filet à droite
     sauf en colonne de droite, filet en bas sauf sur la dernière rangée. Une
     sixième carte ne demandera plus rien. */
  .pd-astro-row .pd-astro-card {
    border-right: 1px solid var(--surface-control);
    border-bottom: 1px solid var(--surface-control);
  }
  .pd-astro-row .pd-astro-card:nth-child(2n) { border-right: 0; }
  .pd-astro-row .pd-astro-card:last-child { border-right: 0; border-bottom: 0; }
  /* l'avant-dernière n'est sur la dernière rangée que si elle est à gauche */
  .pd-astro-row .pd-astro-card:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
}

/* ── CC-INVITATION-FRONT-01 (#550) : l'onglet ACCÈS — membres, invitations,
   révocations (owner). La voix des cartes de détail du drawer. ── */
.pd-acc-head {
  font-size: var(--text-sm, 12px);
  font-weight: 600;
  color: var(--text-strong, #1d2330);
  margin: 0 0 8px;
}
.pd-acc-sub {
  font-size: var(--text-2xs, 11px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-lu, rgba(0, 0, 0, 0.62));
  margin: 14px 0 6px;
}
.pd-acc-card { padding: 4px 0; }
.pd-acc-row {
  display: flex;
  flex-wrap: wrap; /* mails longs + badge + bouton : la ligne se plie au lieu
     de déborder du drawer (constaté en QA) */
  align-items: center;
  gap: 6px 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--surface-control, #f0f2f6);
}
.pd-acc-row:last-child { border-bottom: 0; }
.pd-acc-mail {
  flex: 1 1 150px;
  min-width: 0;
  font-size: var(--text-sm, 12px);
  color: var(--text-strong, #1d2330);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pd-acc-badge {
  flex: none;
  font-size: var(--text-2xs, 11px);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full, 999px);
  background: var(--surface-subtle-5, #eef1f6);
  color: var(--text-muted, #6b7480);
}
.pd-acc-badge-admin { background: var(--surface-accent-soft, #edecfe); color: var(--colo-fresh, #7141D9); }
.pd-acc-badge-editeur { background: var(--surface-success-soft, #e8f8ef); color: var(--color-success, #1a7f4c); }
.pd-acc-wait {
  flex: none;
  font-size: var(--text-2xs, 11px);
  color: var(--text-lu, rgba(0, 0, 0, 0.62));
  font-style: italic;
}
.pd-acc-rm {
  flex: none;
  appearance: none;
  border: 1px solid currentColor;
  background: transparent;
  color: var(--color-danger, #e11d48);
  font-size: var(--text-2xs, 11px);
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full, 999px);
  cursor: pointer;
}
.pd-acc-rm:hover, .pd-acc-rm.is-armed { background: rgba(200, 50, 50, 0.08); }
/* CC-LECTEUR-READONLY-01 (#556) : réarmement VISIBLE — flash bref quand la
   fenêtre de confirmation expire et que le bouton redevient « Révoquer » */
.pd-acc-rm.is-rearm { animation: pd-acc-rearm 0.6s ease; }
@keyframes pd-acc-rearm {
  0%, 100% { background: transparent; }
  30% { background: color-mix(in srgb, var(--color-danger, #e11d48) 22%, transparent); }
}
.pd-acc-rm:disabled { opacity: 0.5; cursor: default; }
.pd-acc-invite {
  margin-top: 14px;
  width: 100%;
  appearance: none;
  border: 0;
  font: inherit;
  font-size: var(--text-md, 14px);
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
}
.pd-acc-invite:hover { filter: brightness(1.07); }

/* #2567 — chiffres de labels ; aucune règle sur les phrases. */
.pd-name-dates { font-family: var(--chrono-font-chiffres); }
