/* BudgetClair V7 - Fenetre de partage. Styles volontairement limites au dialogue.
   Aucun masquage global: les grilles Budget, profils et calendriers restent intacts. */
:root {
  --bc-share-bg: #082536;
  --bc-share-panel: #103244;
  --bc-share-panel-soft: #0a293a;
  --bc-share-line: #2c5063;
  --bc-share-ink: #f1f8fc;
  --bc-share-muted: #a8c4d2;
  --bc-share-highlight: #32c9e7;
  --bc-share-action: #27c3df;
  --bc-share-danger: #f4a5b3;
  --bc-share-danger-bg: #4a303e;
  --bc-share-active: #78e1bf;
  --bc-share-pending: #f0c570;
  --bc-share-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5 7.5 5 5 5-5' stroke='%23a6d5e5' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
html[data-bc-theme='light'] {
  --bc-share-bg: #f5fafe;
  --bc-share-panel: #eaf4f9;
  --bc-share-panel-soft: #f8fcff;
  --bc-share-line: #b4cedd;
  --bc-share-ink: #173b50;
  --bc-share-muted: #4a697c;
  --bc-share-highlight: #087eaa;
  --bc-share-action: #0aa5c8;
  --bc-share-danger: #a62646;
  --bc-share-danger-bg: #f9e6eb;
  --bc-share-active: #127c5c;
  --bc-share-pending: #9a641b;
  --bc-share-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5 7.5 5 5 5-5' stroke='%23436b7e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Reset local : les anciennes regles .bc-share-person flex et .profile-dialog button
   ne doivent plus deformer les lignes et commandes du gestionnaire. */
.bc-share-dialog.profile-dialog {
  box-sizing: border-box;
  width: min(490px, calc(100vw - 24px));
  max-width: 490px;
  max-height: min(90dvh, 960px);
  padding: 0 !important;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--bc-share-line);
  border-radius: 20px;
  background: var(--bc-share-bg);
  color: var(--bc-share-ink);
  box-shadow: 0 22px 65px rgba(0, 8, 21, .50);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  scrollbar-width: thin;
  scrollbar-color: var(--bc-share-line) transparent;
}
.bc-share-dialog::backdrop { background: rgba(0, 13, 24, .74); backdrop-filter: blur(3px); }
.bc-share-dialog, .bc-share-dialog * { box-sizing: border-box; }
.bc-share-dialog [hidden], .bc-share-dialog [hidden] * { display: none !important; }
.bc-share-dialog :is(button,input,select) { font-family: inherit; font-size: 14px; }
.bc-share-dialog :is(button,input,select):focus-visible { outline: 2px solid var(--bc-share-highlight); outline-offset: 3px; }
.bc-share-dialog .bc-share-shell { display: flex; flex-direction: column; gap: 20px; padding: 20px 18px 18px; }

/* Entete identique a la maquette : profil a gauche, embleme a droite. */
.bc-share-dialog .bc-share-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; min-width: 0; }
.bc-share-dialog .bc-share-modal-head h2 { margin: 0; color: var(--bc-share-ink); font-size: 20px; font-weight: 620; letter-spacing: -.022em; line-height: 1.27; }
.bc-share-dialog .bc-share-modal-profile { display: flex; align-items: center; gap: 7px; min-width: 0; margin: 7px 0 0; color: var(--bc-share-muted); font-size: 15px; font-weight: 550; overflow-wrap: anywhere; }
.bc-share-dialog .bc-share-modal-profile svg { width: 17px; height: 17px; flex: none; color: var(--bc-share-highlight); }
.bc-share-dialog .bc-share-head-emblem { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--bc-share-highlight); background: color-mix(in srgb, var(--bc-share-highlight) 15%, var(--bc-share-bg)); }
.bc-share-dialog .bc-share-head-emblem svg { width: 23px; height: 23px; }

/* Carte invitation : etiquettes en dehors des controles segmentes. */
.bc-share-dialog .bc-share-add { display: flex; flex-direction: column; gap: 9px; margin: 0; padding: 15px 13px 13px; border: 1px solid color-mix(in srgb, var(--bc-share-line) 70%, transparent); border-radius: 15px; background: var(--bc-share-panel); }
.bc-share-dialog .bc-share-add h3 { display: flex; align-items: center; gap: 9px; margin: 0 0 7px; color: var(--bc-share-ink); font-size: 16px; font-weight: 620; line-height: 1.4; }
.bc-share-dialog .bc-share-section-icon { display: grid; place-items: center; width: 23px; height: 23px; flex: none; color: var(--bc-share-highlight); }
.bc-share-dialog .bc-share-section-icon svg { width: 23px; height: 23px; }
.bc-share-dialog .bc-share-add > label { display: block; margin: 0; color: var(--bc-share-muted); font-size: 14px; font-weight: 550; line-height: 1.3; }
.bc-share-dialog .bc-share-add input[type='email'] { display: block; width: 100%; min-width: 0; height: 43px; min-height: 43px; margin: 0; padding: 9px 13px; border: 1px solid var(--bc-share-line); border-radius: 11px; outline: 0; background: var(--bc-share-panel-soft); color: var(--bc-share-ink); font-size: 14px; font-weight: 450; }
.bc-share-dialog .bc-share-add input[type='email']::placeholder { color: var(--bc-share-muted); opacity: .85; }
.bc-share-dialog .bc-share-add input[type='email']:focus { border-color: var(--bc-share-highlight); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bc-share-highlight) 13%, transparent); }
.bc-share-dialog .bc-share-lookup { margin: 0; }
.bc-share-dialog .bc-share-lookup:empty { display: none; }
.bc-share-dialog .bc-share-found { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px; border: 1px solid color-mix(in srgb, var(--bc-share-highlight) 38%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--bc-share-highlight) 9%, transparent); }
.bc-share-dialog .bc-share-found-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bc-share-dialog .bc-share-found-name strong { color: var(--bc-share-ink); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.bc-share-dialog .bc-share-found-name small { color: var(--bc-share-highlight); font-size: 14px; }

.bc-share-dialog .bc-share-permission-field { display: block; min-width: 0; margin: 0; padding: 0; border: 0; }
.bc-share-dialog .bc-share-permission-field legend { display: block; float: none; width: auto; margin: 0 0 7px; padding: 0; color: var(--bc-share-muted); font-size: 14px; font-weight: 550; line-height: 1.3; }
.bc-share-dialog .bc-share-permission-choice { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 2px; width: 100%; min-height: 43px; margin: 0; padding: 3px; border: 1px solid var(--bc-share-line); border-radius: 12px; background: var(--bc-share-panel-soft); }
.bc-share-dialog .bc-share-permission-choice label { position: relative; display: block; min-width: 0; margin: 0; padding: 0; border-radius: 9px; cursor: pointer; }
.bc-share-dialog .bc-share-permission-choice input[type='radio'] { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.bc-share-dialog .bc-share-permission-choice label span { display: flex; justify-content: center; align-items: center; width: 100%; min-height: 36px; margin: 0; padding: 7px 4px; border-radius: 9px; color: var(--bc-share-muted); font-size: 14px; font-weight: 530; white-space: nowrap; transition: background-color .15s ease, color .15s ease; }
.bc-share-dialog .bc-share-permission-choice input:checked + span { background: color-mix(in srgb, var(--bc-share-highlight) 20%, var(--bc-share-panel)); color: var(--bc-share-ink); }
.bc-share-dialog .bc-share-permission-choice input:focus-visible + span { outline: 2px solid var(--bc-share-highlight); outline-offset: -2px; }
.bc-share-dialog .bc-share-permission-choice input:not(:checked) + span:hover { color: var(--bc-share-ink); }
.bc-share-dialog .bc-share-invite-submit { display: flex; justify-content: center; align-items: center; gap: 9px; width: 100%; min-height: 45px; margin: 3px 0 0; padding: 10px 13px; border: 1px solid var(--bc-share-action); border-radius: 11px; background: var(--bc-share-action); color: #053044; font-size: 14px; font-weight: 650; line-height: 1.3; cursor: pointer; transition: filter .15s ease, transform .15s ease; }
.bc-share-dialog .bc-share-invite-submit:hover:not(:disabled) { filter: brightness(1.08); }
.bc-share-dialog .bc-share-invite-submit:disabled { background: color-mix(in srgb, var(--bc-share-muted) 13%, var(--bc-share-panel)); border-color: transparent; color: var(--bc-share-muted); cursor: not-allowed; filter: none; }
.bc-share-dialog .bc-share-invite-submit:active { transform: translateY(1px); }
.bc-share-dialog .bc-share-invite-submit svg { width: 18px; height: 18px; flex: none; }

/* Liste : chaque personne est un bloc vertical (PAS display:flex sur le conteneur).
   C'est la correction de la collision responsable des textes verticaux de V6. */
.bc-share-dialog .bc-share-access { display: block; min-width: 0; margin: 0; }
.bc-share-dialog .bc-share-access-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 2px; }
.bc-share-dialog .bc-share-access-heading h3 { margin: 0; color: var(--bc-share-ink); font-size: 16px; font-weight: 620; line-height: 1.35; }
.bc-share-dialog .bc-share-active-count { flex: none; padding: 4px 9px; border-radius: 99px; background: color-mix(in srgb, var(--bc-share-highlight) 11%, var(--bc-share-panel)); color: var(--bc-share-muted); font-size: 14px; line-height: 1.35; }
.bc-share-dialog .bc-share-people { display: block; min-width: 0; }
.bc-share-dialog .bc-share-person { display: block; width: 100%; min-width: 0; margin: 0; padding: 16px 0 14px; border: 0; border-bottom: 1px solid var(--bc-share-line); }
.bc-share-dialog .bc-share-person-head { display: grid; grid-template-columns: 43px minmax(0,1fr) 34px; align-items: center; gap: 10px; width: 100%; min-width: 0; }
.bc-share-dialog .bc-share-avatar { display: grid; place-items: center; flex: none; width: 43px; height: 43px; min-width: 43px; margin: 0; overflow: hidden; border: 0; border-radius: 50%; background: #24576c; color: white; }
.bc-share-dialog .bc-share-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bc-share-dialog .bc-share-avatar-fallback { font-size: 14px; font-weight: 630; line-height: 1; }
.bc-share-dialog .bc-share-person.is-pending .bc-share-avatar { background: #5d5864; }
.bc-share-dialog .bc-share-person-info { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }
.bc-share-dialog .bc-share-person-info strong { display: block; max-width: 100%; color: var(--bc-share-ink); font-size: 15px; font-weight: 630; line-height: 1.35; overflow-wrap: anywhere; }
.bc-share-dialog .bc-share-person-info small { display: block; max-width: 100%; color: var(--bc-share-muted); font-size: 14px; font-weight: 400; line-height: 1.38; overflow-wrap: anywhere; }
.bc-share-dialog .bc-share-status { display: inline-flex; align-items: center; gap: 4px; min-width: 0; color: var(--bc-share-active); font-size: 14px; font-weight: 450; line-height: 1.32; }
.bc-share-dialog .bc-share-status.is-pending { color: var(--bc-share-pending); }
.bc-share-dialog .bc-share-status-icon { display: grid; place-items: center; width: 14px; height: 14px; flex: none; }
.bc-share-dialog .bc-share-status-icon svg { width: 14px; height: 14px; }
.bc-share-dialog .bc-share-person-remove { display: grid; place-items: center; justify-self: end; width: 33px; min-width: 33px; height: 33px; min-height: 33px; margin: 0; padding: 0; border: 1px solid transparent; border-radius: 9px; background: var(--bc-share-danger-bg); color: var(--bc-share-danger); cursor: pointer; transition: border-color .15s ease, transform .15s ease; }
.bc-share-dialog .bc-share-person-remove:hover { border-color: var(--bc-share-danger); }
.bc-share-dialog .bc-share-person-remove:active { transform: translateY(1px); }
.bc-share-dialog .bc-share-person-remove svg { width: 18px; height: 18px; }
.bc-share-dialog .bc-share-permission-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(170px,195px); align-items: center; gap: 12px; width: 100%; min-width: 0; margin: 10px 0 0; }
.bc-share-dialog .bc-share-permission-row label { display: block; width: auto; margin: 0; color: var(--bc-share-muted); font-size: 14px; font-weight: 450; line-height: 1.35; white-space: nowrap; }
.bc-share-dialog .bc-share-person-select { justify-self: end; display: block; width: 100%; max-width: 195px; height: 40px; min-height: 40px; margin: 0; padding: 7px 37px 7px 13px; border: 1px solid var(--bc-share-line); border-radius: 99px; background-color: var(--bc-share-panel-soft); background-image: var(--bc-share-chevron); background-position: right 12px center; background-repeat: no-repeat; background-size: 19px 19px; appearance: none; -webkit-appearance: none; color: var(--bc-share-ink); font-size: 14px; font-weight: 450; cursor: pointer; }
.bc-share-dialog .bc-share-person-select:hover { border-color: var(--bc-share-highlight); }
.bc-share-dialog .bc-share-person-select option { color: var(--bc-share-ink); background-color: var(--bc-share-panel-soft); }
.bc-share-dialog .bc-share-pending-permission { display: block; margin: 5px 0 0 53px; color: var(--bc-share-muted); font-size: 14px; line-height: 1.4; }
.bc-share-dialog .bc-share-empty { margin: 0; padding: 15px 0; color: var(--bc-share-muted); font-size: 14px; }
.bc-share-dialog .bc-share-empty.is-error { color: var(--bc-share-danger); }
.bc-share-dialog .bc-share-confirm { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 12px; padding: 11px; border: 1px solid color-mix(in srgb, var(--bc-share-danger) 45%, transparent); border-radius: 11px; background: var(--bc-share-danger-bg); }
.bc-share-dialog .bc-share-confirm p { margin: 0; color: var(--bc-share-ink); font-size: 14px; font-weight: 450; }
.bc-share-dialog .bc-share-confirm-actions { display: flex; justify-content: flex-end; gap: 9px; }
.bc-share-dialog .bc-share-confirm-actions button { min-height: 39px; padding: 7px 13px; border-radius: 9px; font-size: 14px; font-weight: 580; cursor: pointer; }
.bc-share-dialog .bc-share-secondary, .bc-share-dialog .bc-share-close { border: 1px solid var(--bc-share-line); color: var(--bc-share-ink); background: transparent; }
.bc-share-dialog .bc-share-danger { border: 1px solid var(--bc-share-danger); background: var(--bc-share-danger-bg); color: var(--bc-share-danger); }
.bc-share-dialog .bc-share-modal-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin: 0; padding-top: 0; }
.bc-share-dialog .bc-share-helper { flex: 1; min-width: 190px; margin: 0; color: var(--bc-share-muted); font-size: 14px; font-weight: 400; line-height: 1.5; }
.bc-share-dialog .bc-share-close { flex: none; width: auto; min-height: 39px; margin: 0; padding: 7px 13px; border-radius: 10px; font-size: 14px; font-weight: 550; cursor: pointer; }
.bc-share-dialog :is(.bc-share-close,.bc-share-secondary):hover { border-color: var(--bc-share-highlight); background: color-mix(in srgb, var(--bc-share-highlight) 9%, transparent); }

@media (max-width: 540px) {
  .bc-share-dialog.profile-dialog { width: calc(100vw - 20px); max-width: none; max-height: 91dvh; }
  .bc-share-dialog .bc-share-shell { padding: 17px 13px 14px; gap: 18px; }
  .bc-share-dialog .bc-share-add { padding: 14px 12px 13px; }
  .bc-share-dialog .bc-share-person-head { grid-template-columns: 42px minmax(0,1fr) 34px; gap: 9px; }
  .bc-share-dialog .bc-share-avatar { width: 42px; height: 42px; min-width: 42px; }
  .bc-share-dialog .bc-share-permission-row { grid-template-columns: minmax(0,1fr) minmax(157px,190px); gap: 9px; }
}
@media (max-width: 365px) {
  .bc-share-dialog .bc-share-permission-choice label span { white-space: normal; }
  .bc-share-dialog .bc-share-permission-row { grid-template-columns: 1fr; gap: 6px; }
  .bc-share-dialog .bc-share-person-select { justify-self: stretch; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .bc-share-dialog :is(button,label span) { transition: none !important; }
}

/* Trois roles de partage, sur mobile comme sur ordinateur. */
.bc-share-dialog .bc-share-permission-choice { grid-template-columns: repeat(3,minmax(0,1fr)); }
.bc-share-dialog .bc-share-permission-choice label span { white-space: normal; text-align:center; min-height:48px; overflow-wrap:anywhere; }
@media (max-width: 400px) { .bc-share-dialog .bc-share-permission-choice { grid-template-columns:1fr; } }
