/* ==========================================================================
   Identity pages (static SSR, lot 2): additions to AuthLayout and the account
   security pages (/Account/Manage). Tokens only, no magic values.
   ========================================================================== */

/* ---------- Sign-in / sign-up additions ---------- */
.yb-auth__divider {
  display: flex;
  align-items: center;
  gap: var(--yb-space-3);
  color: var(--yb-text-muted);
  font-size: var(--yb-text-caption);
}

.yb-auth__divider::before,
.yb-auth__divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--yb-border);
}

.yb-passkey-button .mud-button-label,
.yb-link-button .mud-button-label,
.yb-ssr-submit .mud-button-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--yb-space-2);
}

.yb-link-button.mud-button-root {
  text-decoration: none;
}

.yb-auth__hint {
  margin-top: var(--yb-space-3);
  color: var(--yb-text-muted);
  font-size: var(--yb-text-caption);
  text-align: center;
}

/* Audit UX, page 35: « Renvoyer l'e-mail de confirmation » is an action, it reads as a link. */
.yb-auth__hint a {
  color: var(--yb-primary);
  font-weight: var(--yb-weight-medium);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.yb-auth__legal {
  color: var(--yb-text-muted);
  font-size: var(--yb-text-caption);
  line-height: var(--yb-leading-caption);
}

.yb-auth__legal a {
  color: inherit;
}

.yb-auth__perks {
  display: flex;
  flex-direction: column;
  gap: var(--yb-space-2);
  margin: var(--yb-space-8) 0 0;
  padding: var(--yb-space-4) 0 0;
  border-top: 1px dashed var(--yb-border-strong);
  list-style: none;
  color: var(--yb-text-muted);
  font-size: var(--yb-text-caption);
}

.yb-auth__perks li {
  display: flex;
  align-items: center;
  gap: var(--yb-space-2);
}

.yb-auth__perks .mud-icon-root {
  flex: none;
  color: var(--yb-success);
}

.yb-auth__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: var(--yb-space-5);
  border-radius: var(--yb-radius-md);
  background: var(--yb-primary-soft);
  color: var(--yb-on-primary-soft);
}

.yb-otp-field input {
  font-size: var(--yb-text-title-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.18em;
}

/* ---------- Outcome pages ---------- */
.yb-auth-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.yb-auth-result__art {
  margin: 0 0 var(--yb-space-6) calc(-1 * var(--yb-space-3));
}

.yb-auth-result__text {
  margin-bottom: var(--yb-space-8);
  color: var(--yb-text-muted);
}

.yb-auth-result__actions {
  display: flex;
  flex-direction: column;
  gap: var(--yb-space-3);
  align-self: stretch;
}

/* ---------- Status banners (div; the span .yb-status is the status chip of components.css) ---------- */
div.yb-status {
  display: flex;
  gap: var(--yb-space-2);
  align-items: flex-start;
  /* Audit UX, page 37: the chip of components.css (24 px, one line, hidden overflow) must not clip a banner. */
  height: auto;
  overflow: visible;
  white-space: normal;
  line-height: 1.45;
  margin-bottom: var(--yb-space-5);
  padding: var(--yb-space-3) var(--yb-space-4);
  border-radius: var(--yb-radius-sm);
  font-weight: var(--yb-weight-medium);
}

div.yb-status .mud-icon-root {
  flex: none;
  margin-top: 1px;
}

div.yb-status p {
  margin: 0;
}

div.yb-status a {
  color: inherit;
  font-weight: var(--yb-weight-strong);
}

div.yb-status--success {
  background: var(--yb-success-soft);
  color: var(--yb-success);
}

div.yb-status--error {
  background: var(--yb-error-soft);
  color: var(--yb-error);
}

div.yb-status--warning {
  background: var(--yb-warning-soft);
  color: var(--yb-warning);
}

/* ---------- Pills ---------- */
.yb-pill {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: var(--yb-space-1);
  height: 24px;
  padding: 0 var(--yb-space-2);
  border-radius: var(--yb-radius-pill);
  background: var(--yb-status-neutral-bg);
  color: var(--yb-status-neutral-fg);
  font-size: var(--yb-text-caption);
  font-weight: var(--yb-weight-medium);
  white-space: nowrap;
}

.yb-pill .mud-icon-root {
  font-size: 16px;
}

.yb-pill--good {
  background: var(--yb-status-green-bg);
  color: var(--yb-status-green-fg);
}

.yb-pill--warn {
  background: var(--yb-status-amber-bg);
  color: var(--yb-status-amber-fg);
}

/* ---------- Danger buttons ---------- */
.yb-danger-filled.mud-button-root {
  background-color: var(--yb-error);
  color: var(--yb-surface);
}

.yb-danger-filled.mud-button-root:hover {
  background-color: var(--yb-error);
  filter: brightness(0.92);
}

.yb-danger-outline.mud-button-root {
  border-color: var(--yb-error);
  color: var(--yb-error);
}

.yb-text-button {
  min-height: 36px;
  padding: 0 var(--yb-space-3);
  border: 0;
  border-radius: var(--yb-radius-sm);
  background: none;
  color: var(--yb-primary);
  font: inherit;
  font-weight: var(--yb-weight-medium);
  cursor: pointer;
}

.yb-text-button:hover {
  background: var(--yb-hover);
}

.yb-text-button:focus-visible {
  outline: 2px solid var(--yb-focus);
  outline-offset: 2px;
}

.yb-text-button--danger {
  color: var(--yb-error);
}

/* ---------- Account security layout ---------- */
.yb-manage {
  min-height: 100dvh;
  padding: 0 var(--yb-sheet-inset) var(--yb-sheet-inset);
  background: var(--yb-frame);
}

.yb-manage__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--yb-topbar-height);
  padding: 0 var(--yb-space-4);
}

.yb-manage__back {
  display: inline-flex;
  align-items: center;
  gap: var(--yb-space-2);
  min-height: 40px;
  padding: 0 var(--yb-space-3) 0 var(--yb-space-2);
  border-radius: var(--yb-radius-sm);
  color: var(--yb-text);
  font-weight: var(--yb-weight-medium);
  text-decoration: none;
}

.yb-manage__back:hover {
  background: var(--yb-hover);
}

.yb-manage__sheet {
  min-height: calc(100dvh - var(--yb-topbar-height) - var(--yb-sheet-inset));
  border: 1px solid var(--yb-border);
  border-radius: var(--yb-radius-lg);
  background: var(--yb-bg);
}

.yb-manage__inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--yb-space-10) var(--yb-space-8) var(--yb-space-16);
}

.yb-manage__heading {
  margin-bottom: var(--yb-space-8);
}

.yb-manage__subtitle {
  margin-top: var(--yb-space-1);
  color: var(--yb-text-muted);
}

.yb-manage__grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--yb-space-8);
  align-items: start;
}

.yb-manage__nav {
  position: sticky;
  top: var(--yb-space-6);
}

.yb-manage__nav ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.yb-manage__nav-link {
  display: flex;
  align-items: center;
  gap: var(--yb-space-3);
  min-height: 40px;
  padding: 0 var(--yb-space-3);
  border: 1px solid transparent;
  border-radius: var(--yb-radius-sm);
  color: var(--yb-text-muted);
  font-weight: var(--yb-weight-medium);
  text-decoration: none;
  white-space: nowrap;
}

.yb-manage__nav-link:hover {
  background: var(--yb-hover);
  color: var(--yb-text);
}

.yb-manage__nav-link--active,
.yb-manage__nav-link--active:hover {
  border-color: var(--yb-border);
  background: var(--yb-surface);
  color: var(--yb-text);
}

.yb-manage__nav-link--active .mud-icon-root {
  color: var(--yb-primary);
}

.yb-manage__content:focus {
  outline: none;
}

.yb-manage-panel {
  border: 1px solid var(--yb-border);
  border-radius: var(--yb-radius-md);
  background: var(--yb-surface);
  padding: var(--yb-space-6);
}

.yb-manage-panel--danger {
  border-color: var(--yb-error-soft);
}

.yb-manage-panel__header {
  margin-bottom: var(--yb-space-6);
}

.yb-manage-panel__title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--yb-space-3);
}

.yb-manage-panel__title {
  font-size: var(--yb-text-title-2);
  font-weight: var(--yb-weight-title-2);
  line-height: var(--yb-leading-title-2);
  letter-spacing: var(--yb-tracking-title-2);
}

.yb-manage-panel__text {
  max-width: 62ch;
  margin-top: var(--yb-space-1);
  color: var(--yb-text-muted);
}

/* Overview list */
.yb-passkeys {
  margin: 0 calc(-1 * var(--yb-space-6));
  padding: 0;
  border-top: 1px solid var(--yb-border);
  list-style: none;
}

.yb-passkeys__item + .yb-passkeys__item {
  border-top: 1px solid var(--yb-border);
}

.yb-security-item,
.yb-passkeys__item {
  display: flex;
  align-items: center;
  gap: var(--yb-space-4);
  min-height: 64px;
  padding: var(--yb-space-3) var(--yb-space-6);
  color: var(--yb-text);
  text-decoration: none;
}

.yb-security-item:hover {
  background: var(--yb-hover);
}

.yb-security-item:focus-visible {
  outline: 2px solid var(--yb-focus);
  outline-offset: -2px;
}

.yb-security-item__icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--yb-radius-sm);
  background: var(--yb-primary-soft);
  color: var(--yb-on-primary-soft);
}

.yb-security-item__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.yb-security-item__title {
  font-weight: var(--yb-weight-strong);
}

.yb-security-item__detail {
  color: var(--yb-text-muted);
  font-size: var(--yb-text-caption);
}

.yb-passkeys {
  margin-bottom: var(--yb-space-6);
  border-bottom: 1px solid var(--yb-border);
}

.yb-passkeys__actions {
  display: flex;
  flex: none;
  gap: var(--yb-space-1);
}

.yb-manage-empty {
  display: flex;
  align-items: center;
  gap: var(--yb-space-3);
  margin-bottom: var(--yb-space-6);
  padding: var(--yb-space-5);
  border: 1px dashed var(--yb-border-strong);
  border-radius: var(--yb-radius-md);
  color: var(--yb-text-muted);
}

/* Current value line */
.yb-manage-current {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--yb-space-3);
  margin-bottom: var(--yb-space-6);
  padding: var(--yb-space-4);
  border-radius: var(--yb-radius-sm);
  background: var(--yb-bg-sunken);
}

.yb-manage-current__label {
  color: var(--yb-text-muted);
  font-size: var(--yb-text-caption);
}

.yb-manage-current__value {
  flex: 1;
  min-width: 0;
  font-weight: var(--yb-weight-strong);
}

.yb-manage-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--yb-space-3);
  margin-bottom: var(--yb-space-6);
  padding-bottom: var(--yb-space-6);
  border-bottom: 1px solid var(--yb-border);
}

.yb-manage-inline p {
  max-width: 48ch;
  color: var(--yb-text-muted);
}

/* Forms */
.yb-manage-form {
  display: flex;
  flex-direction: column;
  gap: var(--yb-space-5);
  max-width: 440px;
}

.yb-manage-form--narrow {
  max-width: 360px;
}

.yb-manage-form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--yb-space-4);
}

.yb-manage-form__actions .yb-ssr-submit.mud-button-root {
  margin-top: 0;
}

/* Blocks (one setting with its action) */
.yb-manage-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--yb-space-4);
  padding: var(--yb-space-5) 0;
  border-top: 1px solid var(--yb-border);
}

.yb-manage-block:last-child {
  padding-bottom: 0;
}

.yb-manage-block__text {
  flex: 1 1 320px;
}

.yb-manage-block__text p {
  color: var(--yb-text-muted);
}

.yb-manage-block__title {
  font-size: var(--yb-text-title-3);
  font-weight: var(--yb-weight-title-3);
  line-height: var(--yb-leading-title-3);
}

.yb-manage-block__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--yb-space-2);
}

.yb-manage-block--danger .yb-manage-block__title {
  color: var(--yb-error);
}

/* Authenticator set-up */
.yb-steps {
  display: flex;
  flex-direction: column;
  gap: var(--yb-space-6);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: yb-step;
}

.yb-steps__item {
  position: relative;
  padding-left: 44px;
  counter-increment: yb-step;
}

.yb-steps__item::before {
  content: counter(yb-step);
  position: absolute;
  top: -2px;
  left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--yb-primary);
  color: var(--yb-on-primary);
  font-size: var(--yb-text-caption);
  font-weight: var(--yb-weight-strong);
}

.yb-steps__title {
  margin-bottom: var(--yb-space-2);
  font-size: var(--yb-text-title-3);
  font-weight: var(--yb-weight-title-3);
  line-height: var(--yb-leading-title-3);
}

.yb-steps__item > p {
  color: var(--yb-text-muted);
}

.yb-qr-setup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--yb-space-6);
}

.yb-qr-setup__code {
  flex: none;
  width: 168px;
  padding: var(--yb-space-2);
  border: 1px solid var(--yb-border);
  border-radius: var(--yb-radius-sm);
  /* Always white, also in dark mode: scanners need dark modules on a light background. */
  background: #fff;
}

.yb-qr-setup__code svg {
  display: block;
  width: 100%;
  height: auto;
}

.yb-qr-setup__key {
  flex: 1 1 220px;
  color: var(--yb-text-muted);
}

.yb-key {
  display: inline-block;
  margin-top: var(--yb-space-2);
  padding: var(--yb-space-2) var(--yb-space-3);
  border-radius: var(--yb-radius-sm);
  background: var(--yb-bg-sunken);
  color: var(--yb-text);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: var(--yb-text-body);
  letter-spacing: 0.06em;
  word-break: break-all;
}

.yb-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--yb-space-2);
  margin: 0 0 var(--yb-space-6);
  padding: var(--yb-space-4);
  border: 1px dashed var(--yb-border-strong);
  border-radius: var(--yb-radius-md);
  list-style: none;
}

.yb-codes code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: var(--yb-text-body);
  letter-spacing: 0.06em;
}

@media (max-width: 899px) {
  /* Audit UX, page 37: minmax(0, 1fr), the column no longer grows to its widest content (cut at 390 px). */
  .yb-manage__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--yb-space-5);
  }

  .yb-manage__nav {
    position: static;
  }

  /* Sections as wrapping chips: the current one is always visible. */
  .yb-manage__nav ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--yb-space-2);
  }

  .yb-manage__nav-link {
    min-height: 36px;
    padding: 0 var(--yb-space-3) 0 var(--yb-space-2);
    border-color: var(--yb-border);
    border-radius: var(--yb-radius-pill);
    font-size: var(--yb-text-caption);
  }

  .yb-manage__nav-link--active,
  .yb-manage__nav-link--active:hover {
    border-color: var(--yb-text);
    background: var(--yb-text);
    color: var(--yb-bg);
  }

  .yb-manage__nav-link--active .mud-icon-root {
    color: inherit;
  }
}

@media (max-width: 767px) {
  .yb-manage {
    padding: 0;
  }

  .yb-manage__sheet {
    border-width: 1px 0 0;
    border-radius: var(--yb-radius-lg) var(--yb-radius-lg) 0 0;
  }

  .yb-manage__inner {
    padding: var(--yb-space-6) var(--yb-space-4) var(--yb-space-12);
  }

  .yb-manage-panel {
    padding: var(--yb-space-5) var(--yb-space-4);
  }

  .yb-passkeys {
    margin: 0 calc(-1 * var(--yb-space-4));
  }

  .yb-security-item,
  .yb-passkeys__item {
    padding: var(--yb-space-3) var(--yb-space-4);
  }

  .yb-passkeys__item {
    flex-wrap: wrap;
  }

  .yb-manage-form,
  .yb-manage-form--narrow {
    max-width: none;
  }

  .yb-codes {
    grid-template-columns: 1fr;
  }
}

/* ---------- Invitation (lot 19): a ticket, company and role above the perforation, action below ---------- */
.yb-invite {
  border: 1px solid var(--yb-border-strong);
  border-radius: var(--yb-radius-lg);
  background: var(--yb-surface);
  box-shadow: var(--yb-shadow-xs);
}

.yb-invite__head {
  display: flex;
  gap: var(--yb-space-4);
  padding: var(--yb-space-5) var(--yb-space-5) var(--yb-space-4);
}

.yb-invite__monogram {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--yb-radius-md);
  background: var(--yb-primary);
  color: var(--yb-on-primary);
  font-size: var(--yb-text-title-3);
  font-weight: var(--yb-weight-title-1);
  letter-spacing: 0.02em;
}

.yb-invite__company {
  min-width: 0;
}

.yb-invite__name {
  font-size: var(--yb-text-title-2);
  font-weight: var(--yb-weight-title-2);
  line-height: var(--yb-leading-title-2);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.yb-invite__role {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--yb-space-2);
  margin-top: var(--yb-space-2);
}

.yb-invite__role-help {
  flex-basis: 100%;
  color: var(--yb-text-muted);
  font-size: var(--yb-text-caption);
  line-height: var(--yb-leading-caption);
}

.yb-invite__facts {
  display: flex;
  flex-direction: column;
  gap: var(--yb-space-2);
  margin: 0;
  padding: var(--yb-space-3) var(--yb-space-5) var(--yb-space-4);
  border-top: 1px solid var(--yb-border);
}

/* One fact per line, label left and value right: a long address keeps the whole width. */
.yb-invite__facts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--yb-space-4);
}

.yb-invite__facts dt {
  flex: none;
  color: var(--yb-text-muted);
  font-size: var(--yb-text-caption);
}

.yb-invite__facts dd {
  min-width: 0;
  margin: 0;
  font-weight: var(--yb-weight-medium);
  text-align: right;
}

.yb-invite__email {
  overflow-wrap: anywhere;
}

.yb-invite__perforation {
  margin: 0 var(--yb-space-2);
}

.yb-invite .yb-perforation__scissors.mud-icon-root {
  background: var(--yb-surface);
}

.yb-invite__slip {
  display: flex;
  flex-direction: column;
  gap: var(--yb-space-3);
  padding: var(--yb-space-4) var(--yb-space-5) var(--yb-space-5);
}

.yb-invite__hint {
  color: var(--yb-text-muted);
  font-size: var(--yb-text-caption);
  line-height: var(--yb-leading-caption);
}

.yb-invite__form {
  display: flex;
  flex-direction: column;
}

.yb-invite__signed-in {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--yb-space-1);
  color: var(--yb-text-muted);
  font-size: var(--yb-text-caption);
  overflow-wrap: anywhere;
}

.yb-invite__mismatch {
  display: flex;
  gap: var(--yb-space-3);
  padding: var(--yb-space-3) var(--yb-space-4);
  border-radius: var(--yb-radius-sm);
  background: var(--yb-status-amber-bg);
  color: var(--yb-text);
  font-size: var(--yb-text-caption);
  line-height: var(--yb-leading-caption);
}

.yb-invite__mismatch > .mud-icon-root {
  flex: none;
  color: var(--yb-status-amber-fg);
}

.yb-invite__mismatch-title {
  margin-bottom: var(--yb-space-1);
  font-size: var(--yb-text-body);
  font-weight: var(--yb-weight-strong);
}

.yb-invite__mismatch p {
  overflow-wrap: anywhere;
}

/* Audit UX, pages 33–35: « Afficher le mot de passe », an eye at the end of the field. */
.yb-ssr-field--reveal .mud-input {
  position: relative;
}

.yb-ssr-field--reveal input {
  padding-right: 44px;
}

.yb-ssr-reveal {
  position: absolute;
  top: 50%;
  right: 4px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--yb-radius-sm);
  background: transparent;
  color: var(--yb-text-muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.yb-ssr-reveal:hover {
  color: var(--yb-text);
}

.yb-ssr-reveal:focus-visible {
  outline: 2px solid var(--yb-focus, var(--yb-primary));
  outline-offset: 0;
}

.yb-ssr-reveal__hide,
.yb-ssr-reveal.is-shown .yb-ssr-reveal__show {
  display: none;
}

.yb-ssr-reveal.is-shown .yb-ssr-reveal__hide {
  display: inline-block;
}

/* Audit UX, page 35: an address brought by the link is shown, not to be typed (read-only, greyed). */
.yb-ssr-field input[readonly] {
  color: var(--yb-text-muted);
  cursor: default;
}

.yb-ssr-field .mud-input:has(input[readonly]) {
  background: var(--yb-bg-sunken);
}
