.account {
  position: relative;
  flex: none;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.account-actions :is(button,a) {
  display:inline-flex;align-items:center;justify-content:center;
  min-height: 36px;
  padding: 6px 11px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.account-sign-in:hover {
  border-color: #cdcec2;
  background: #eeeee6;
}

.account-actions .account-sign-up {
  background: #234738;
  color: #f7f5ef;
}

.account-actions .account-sign-up:hover {
  background: #173b30;
}

.account-user {
  display: grid;
  min-width: 40px;
  place-items: center;
}

.sg-account-menu :is(a,button):has([data-account-menu-divider="true"]),
.sg-account-menu-divider {
  margin-block-start: 6px;
  box-shadow: 0 -1px 0 var(--studio-clerk-border);
}

.account-status {
  position: fixed;
  z-index: 20;
  right: max(4%, 12px);
  bottom: 18px;
  width: min(250px, 85vw);
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #cdcec2;
  border-radius: 6px;
  background: #fffef9;
  box-shadow: 0 6px 18px #19282318;
  font-size: 13px;
  line-height: 1.45;
}

#account-dialog {
  width: min(448px, calc(100% - 20px));
  padding: 0 10px 14px;
  border: 0;
  background: transparent;
}

.account-dialog-head {
  display: flex;
  justify-content: flex-end;
  padding-bottom: 6px;
}

.account-dialog-head button {
  border-radius: 50%;
  background: #f7f5ef;
  color: #192823;
}

#account-auth-mount > * { max-width: 100%; margin-inline: auto; }

.account-symbol,
.cl-userPreviewAvatarContainer__userButton .cl-userPreviewAvatarBox {
  --account-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='3.2'/%3E%3Cpath d='M5 19c.7-3.4 3-5.3 7-5.3s6.3 1.9 7 5.3'/%3E%3C/svg%3E");
  place-items: center;
  border-radius: 50%;
  background: #244738;
  color: #f9f4e6;
}
.account-symbol::before,
.cl-userPreviewAvatarContainer__userButton .cl-userPreviewAvatarBox::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  inline-size: 20px;
  block-size: 20px;
  background-color: currentColor;
  mask: var(--account-glyph) center / contain no-repeat;
  forced-color-adjust: none;
}
.account-symbol {
  display: none;
  position: absolute;
  inset: 4px 4px auto auto;
  width: 36px;
  height: 36px;
  pointer-events: none;
}
.cl-userPreviewAvatarContainer__userButton .cl-userPreviewAvatarBox {
  position: relative;
  flex: 0 0 36px;
  inline-size: 36px;
  block-size: 36px;
}
.cl-userPreviewAvatarContainer__userButton .cl-userPreviewAvatarImage { display: none; }
:is([data-account-state="restoring"], [data-account-state="signed-in"]) .mast .account-symbol { display: grid; }
.mast #account-user {position:relative;width:44px;height:44px}
.mast #account-user .cl-userButtonTrigger {width:44px;height:44px;opacity:0}
.mast #account:has(.cl-userButtonTrigger:focus-visible) .account-symbol {outline:2px solid #9d512d;outline-offset:2px}
.mast #account:has(.cl-userButtonTrigger:hover) .account-symbol {background:#345a47}
.ac-account .account-symbol {top:50%;transform:translateY(-50%)}

dialog#account-dialog {
  box-sizing:border-box;
  width:min(28rem,calc(100% - 16px));
  max-width:calc(100% - 16px);
  max-height:calc(100dvh - 16px);
  padding:6px;
  overflow-y:auto;
}
dialog#account-dialog[open]:has(.account-mount-status) {
  position:fixed;
  inset:0;
  margin:auto;
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  padding:0;
  overflow:hidden;
  border:1px solid var(--studio-clerk-border);
  border-radius:14px;
  background:var(--studio-clerk-background);
  color:var(--studio-clerk-foreground);
}
dialog#account-dialog[open]:has(.account-mount-status):not(:has(#account-auth-mount :is(input,button,a[href],[role="alert"]))) {
  min-height:min(32rem,calc(100dvh - 16px));
}
#account-dialog:has(.account-mount-status) .account-dialog-head {
  align-items:center;
  margin:0;
  padding:6px 10px;
}
#account-dialog .account-mount-status,
#account-dialog:has(.account-mount-status) #account-auth-mount {grid-area:2 / 1}
#account-dialog:has(.account-mount-status) #account-auth-mount {
  overflow:auto;
  overscroll-behavior:contain;
  scrollbar-width:thin;
  scrollbar-color:var(--studio-clerk-border) transparent;
}
#account-auth-mount:focus {outline:none}
#account-dialog .account-mount-status {
  position:relative;
  z-index:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:16px;
  margin:0;
  padding:1rem;
  background:var(--studio-clerk-background);
  text-align:center;
}
#account-dialog .account-mount-status::before {
  content:"";
  width:24px;
  height:24px;
  border:2px solid var(--studio-clerk-border);
  border-top-color:var(--studio-clerk-foreground);
  border-radius:50%;
}
@media(prefers-reduced-motion:no-preference) {
  #account-dialog .account-mount-status::before {animation:account-spin .85s linear infinite}
  @keyframes account-spin {to {transform:rotate(1turn)}}
}
#account-dialog:has(#account-auth-mount :is(input,button,a[href],[role="alert"])) .account-mount-status {display:none}
#account-auth-mount .cl-cardBox {border-radius:0;box-shadow:none}
#account-auth-mount,
#account-auth-mount :is(.cl-rootBox,.cl-cardBox,.cl-card,.cl-footer) {
  box-sizing:border-box;
  min-width:0;
  width:100%;
  max-width:100%;
}
/* Clerk's logo placeholder is taller than the loaded wordmark. */
#account-auth-mount .cl-logoBox {height:24px}
#account-auth-mount .cl-logoImage {max-height:100%;width:auto;object-fit:contain}
@media(max-width:440px) {
  #account-auth-mount .cl-card,
  #account-auth-mount .cl-footer {padding-inline:clamp(12px,5vw,22px)}
  #account-auth-mount .cl-formFieldInput {min-width:0;max-width:100%}
}

/* Clerk draws six visible segments over one native verification input. */
#account-auth-mount .cl-otpCodeFieldInput {
  border:1px solid #68796e;
  background-color:var(--studio-clerk-input);
  color:var(--studio-clerk-foreground);
}
:root[data-theme="dark"] #account-auth-mount .cl-otpCodeFieldInput {
  border-color:#9aaa9d;
}
#account-auth-mount .cl-otpCodeFieldInput:has(> div[aria-hidden], > div > div:only-child),
#account-auth-mount .cl-otpCodeFieldInput[data-focus="true"] {
  outline:2px solid var(--studio-clerk-foreground);
  outline-offset:1px;
}

#account-dialog[data-return-here]::backdrop {background:#101d17bd}
#account-dialog[data-return-here] #account-close {
  display:grid;
  place-items:center;
  width:36px;
  height:36px;
  padding:0;
  border:0;
  cursor:pointer;
}
#account-dialog[data-return-here] #account-close:focus-visible {
  outline:1px solid var(--studio-clerk-foreground);
  outline-offset:1px;
}
