/* Flow auth modal + header user menu (LRW-inspired, blue accent) */
:root {
  --fla-auth-accent: #005bb9;
  --fla-auth-accent-soft: #e8f1fb;
  --fla-auth-border: #d0d7de;
  --fla-auth-text: #1f2328;
  --fla-auth-muted: #656d76;
}

.header-1__auth,
.header-2__auth {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

.fla-user-dd {
  position: relative;
}
.fla-user-dd > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0.25rem;
  border-radius: 999px;
  color: var(--fla-auth-text);
}
.fla-user-dd > summary::-webkit-details-marker { display: none; }
.fla-user-dd > summary:hover { background: var(--fla-auth-accent-soft); color: var(--fla-auth-accent); }
.fla-user-dd[open] > summary { background: var(--fla-auth-accent-soft); color: var(--fla-auth-accent); }
.fla-user-dd > summary .expand {
  font-size: 1.15rem;
  margin-inline-start: -0.15rem;
  transition: transform 0.15s ease;
}
.fla-user-dd[open] > summary .expand {
  transform: rotate(180deg);
}

.fla-user-avatar {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background: transparent;
  border: 1px solid #000;
  color: #000;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  /* letter-spacing adds trailing space — indent so initials sit optically centered */
  text-indent: 0.02em;
  line-height: 1;
  text-align: center;
}
/* Summary hover/open sets accent color — keep monogram black. */
.fla-user-dd > summary:hover .fla-user-avatar:not(.fla-user-avatar--guest),
.fla-user-dd[open] > summary .fla-user-avatar:not(.fla-user-avatar--guest) {
  color: #000;
  border-color: #000;
}
.fla-user-avatar--guest {
  background: transparent;
  color: var(--fla-auth-text);
  border: none;
}
.fla-user-avatar--guest .material-symbols-outlined { font-size: 1.25rem; }

.fla-user-dd > ul {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 220px;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--fla-auth-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 80;
}
/* Prevent closed-menu FOUC (absolute children can paint before details slot hides). */
.fla-user-dd:not([open]) > ul {
  display: none !important;
}
.fla-user-dd > ul a,
.fla-user-dd > ul button {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}
.fla-user-dd > ul a:hover,
.fla-user-dd > ul button:hover {
  background: var(--fla-auth-accent-soft);
  color: var(--fla-auth-accent);
}
.fla-user-dd > ul > li[hidden],
.fla-user-dd > ul > li[data-auth-filtered] {
  display: none !important;
}
.fla-user-dd > ul .material-symbols-outlined { font-size: 1.15rem; }
.fla-user-dd__head {
  padding: 0.65rem 0.85rem 0.45rem;
  border-bottom: 1px solid var(--fla-auth-border);
  margin-bottom: 0.25rem;
}
.fla-user-dd__head strong { display: block; font-size: 0.95rem; }
.fla-user-dd__head span { display: block; font-size: 0.8rem; color: var(--fla-auth-muted); }
.fla-user-dd__divider {
  height: 1px;
  background: var(--fla-auth-border);
  margin: 0.25rem 0;
}

.fla-auth-modal {
  position: fixed;
  inset: 0;
  /* Above editor-rail (2147483600) so login never sits under the pencil/rail. */
  z-index: 2147483640;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.45);
  padding: 1rem;
}
.fla-auth-modal[hidden] {
  display: none !important;
  pointer-events: none !important;
}
.fla-auth-modal__inner {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--fla-auth-border);
  box-shadow: 0 16px 48px rgba(0, 91, 185, 0.18);
  position: relative;
  padding: 1.25rem 1.25rem 1.5rem;
}
.fla-auth-modal__close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--fla-auth-muted);
}
.fla-auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--fla-auth-border);
}
.fla-auth-tabs button {
  border: 0;
  background: transparent;
  padding: 0.55rem 0.35rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  color: var(--fla-auth-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.fla-auth-tabs button.is-active {
  color: var(--fla-auth-accent);
  border-bottom-color: var(--fla-auth-accent);
}
.fla-auth-tabs button[hidden] { display: none !important; }
.fla-auth-pane[hidden] { display: none !important; }
.fla-auth-activate-hint,
.fla-auth-forgot-lead,
.fla-auth-forgot-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--fla-auth-muted);
  line-height: 1.4;
}
.fla-auth-forgot-title {
  font-weight: 600;
  color: var(--fla-auth-text);
  font-size: 1rem;
}
.fla-auth-activate-hint[hidden] { display: none !important; }
.fla-auth-form[hidden] { display: none !important; }
.fla-auth-form {
  display: grid;
  gap: 0.75rem;
}
.fla-auth-form label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fla-auth-muted);
}
.fla-auth-form input {
  border: 1px solid var(--fla-auth-border);
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
  font: inherit;
  color: var(--fla-auth-text);
}
.fla-auth-form input:focus {
  outline: 2px solid color-mix(in srgb, var(--fla-auth-accent) 35%, transparent);
  border-color: var(--fla-auth-accent);
}
.fla-auth-form .fla-auth-submit {
  margin-top: 0.25rem;
  border: 0;
  border-radius: 6px;
  background: var(--fla-auth-accent);
  color: #fff;
  font-weight: 600;
  padding: 0.65rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.fla-auth-form .fla-auth-submit:hover { filter: brightness(1.05); }
.fla-auth-form .fla-auth-submit.is-busy::before {
  content: "";
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fla-auth-spin 0.7s linear infinite;
}
/* While waiting for auth API: lock the whole dialog; backdrop still captures clicks. */
.fla-auth-modal[data-busy="1"] {
  cursor: progress;
}
.fla-auth-modal[data-busy="1"] .fla-auth-modal__inner,
.fla-auth-modal[data-busy="1"] .fla-auth-modal__inner * {
  pointer-events: none !important;
}
@keyframes fla-auth-spin {
  to { transform: rotate(360deg); }
}
.fla-auth-error {
  color: #cf222e;
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
}
.fla-auth-error[hidden] { display: none !important; }
.fla-auth-switch {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--fla-auth-muted);
}
.fla-auth-switch button {
  border: 0;
  background: none;
  color: var(--fla-auth-accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}
